File::Dir::Map - Map a directory recursively
Version 0.01
The following snippet summarizes what File::Dir::Map does.
Files are copied from src to build dirs such that files with extension ignore will not be copied, files with extension markdown will get processed by markdown and saved in build dir, and files with extension raw are guaranteed to be copied without processing but stripped of the raw extension.
use File::Dir::Map qw(dirmap); use Text::MultiMarkdown qw(markdown); dirmap src => build => { ignore => sub{ [] }, raw => sub{ my( $name, $content ) = @_; [ $name, $content ]; }, markrown => sub{ my( $name, $contnet ) = @_; [ "$name.html", markdown $content ] }, };
So this before the map:
src/pages/todo.ignore src/pages/index.markdown src/pages/about.html src/pages/index.markdown.raw src/files/ build/some/junk/here.txt
Will be this after the map:
src/pages/todo.ignore src/pages/index.markdown src/pages/about.html src/pages/index.markdown.raw src/files/ build/pages/index.html build/pages/about.html build/pages/index.markdown build/files/
Note that old build directory is purged!
dirmap
$funcs is a hashref with file extensions as keys and mapping functions as values.
Each mapping function takes two arguments: filename stripped of the extension and file contents.
Each mapping function should return a listref that's either empty or contains two elements: new filename and new content. In case the listref is empty, file will not be saved in the destination directory.
Eugene Grigoriev, <perl at sizur.com>
<perl at sizur.com>
Please report any bugs or feature requests to bug-file-dir-map at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=File-Dir-Map. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-file-dir-map at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc File::Dir::Map
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=File-Dir-Map
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/File-Dir-Map
CPAN Ratings
http://cpanratings.perl.org/d/File-Dir-Map
Search CPAN
http://search.cpan.org/dist/File-Dir-Map/
Copyright 2010 Eugene Grigoriev.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install File::Dir::Map, copy and paste the appropriate command in to your terminal.
cpanm
cpanm File::Dir::Map
CPAN shell
perl -MCPAN -e shell install File::Dir::Map
For more information on module installation, please visit the detailed CPAN module installation guide.