Document::Maker - Makefile-like functionality in Perl
Version 0.022
my $maker = Document::Maker->new; $maker->parser->parse_target( "tgt/a.out" => "src/defs.txt", do => sub { my $target = shift; my $file = shift; # tgt/a.out .... }, ); $maker->make("tgt/a.out"); # Will only make if "tgt/a.out" is older than "src/defs.txt" or doesn't exist
Document::Maker is intended to have similar functionality as GNU make with additional enhancements.
WARNING: Although this is a 3rd-iteration attempt at Makefile-ness, the API is very fluid and could change in future versions.
WARNING: There may be bugs lurking about, I'll be happy to entertain bug reports.
$maker->parser->parse_target( "tgt/a.out" => "src/defs.txt", do => sub { my $target = shift; my $file = shift; # tgt/a.out .... }, );
$maker->parser->parse_target( "tgt/a.out" => [ "src/defs.txt", "src/xyzzy.txt" ], do => sub { my $target = shift; my $file = shift; # tgt/a.out .... }, );
$maker->parser->parse_target( [ "tgt/a.out", "tgt/b.out" ] => [ "src/defs.txt", "src/xyzzy.txt" ], do => sub { my $target = shift; my $file = shift; .... }, );
$maker->parser->parse_simple_target( "configure", do => sub { my $target = shift; # No second argument .... }, );
$maker->parser->parse_pattern_target(qw( tgt/%.html src/%.in a b c d e ), [ "header.html" ], { do => sub { my $target = shift; my $file = shift; # tgt/a.html, tgt/b.html, etc. my $source_file = shift; # src/a.in, src/b.in, etc. .... }, });
# This will crawl src/ looking for every file matching the src pattern and making a target out of it $maker->parser->parse_pattern_target(qw( tgt/%.html src/%.in src/* ), [ "header.html" ], { do => sub { my $target = shift; my $file = shift; my $source_file = shift; .... }, });
For example, something like:
$maker->parser->parse...(..., do => \<<_END_); @echo "Using m4 first before getting a line count" m4 < main.m4 $< | wc -l > $@ _END_
Robert Krimen, <rkrimen at cpan.org>
<rkrimen at cpan.org>
Please report any bugs or feature requests to bug-document-maker at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Document-Maker. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-document-maker at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Document::Maker
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Document-Maker
CPAN Ratings
http://cpanratings.perl.org/d/Document-Maker
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Document-Maker
Search CPAN
http://search.cpan.org/dist/Document-Maker
Copyright 2007 Robert Krimen, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Document::Maker, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Document::Maker
CPAN shell
perl -MCPAN -e shell install Document::Maker
For more information on module installation, please visit the detailed CPAN module installation guide.