NAME

Make::PurePerl - make functionality for Perl

SYNOPSIS

  use Make::PurePerl;

  my $set = Make::PurePerl->new();

  $set->rule( $target, sub { ... }, @sources );
  $set->name( 'cache' )
        ->rule(@targets, sub { ... }, @sources);
  $set->rule( $output, sub { ... }, \'cache' );

  # if you don't like the direction of parameters,
  # try the pipeline syntax:
  $set->pipeline( @sources => sub { ... } => @targets );

  # now kick it off:
  $set->make();

new

Returns a new ruleset.

rule TARGET CODE SOURCES [ARGS]

The parameter list for rule is best read as "To create TARGET, apply CODE to SOURCES".

The optional ARGS must be a hash reference and can contain the rule name if you don't want to use the name method.

auto_rule TARGETSPEC, CODE, SOURCESPEC, PREREQUISITES

auto_rule automatically creates rules using a wildcard pattern like the % expansion in GNU make.

  $set->auto_rule( 'output/%.html', \&make_page, 'input/%.content', @templates );

The above line would add a target output/foo.html for input/foo.content, and so on, recursing downwards, and ignoring files in any directory called CVS. Intermediate directories will also be created automatically.

The behaviour of ignoring CVS subdirectories cannot be changed. The later intention is to have a File::Find::Rule rule for ignored files.

pipeline SOURCES CODE TARGET [ARGS]

The parameter list for pipeline is best read as "Take SOURCES, apply CODE to create TARGET". Otherwise, it is just syntactic candy around rule, to allow for left-to-right reading of the parameter list as a pipeline transformation much like shell syntax:

  $set->pipeline( @sources => sub { ... } => $target );

name NAMES

Adds the subsequent transformation rules to the meta targets specified in NAMES. This is syntactic sugar:

  $set->name('cache')
        ->rule('foo1', sub {...}, 'bar1')
        ->rule('foo2', sub {...}, 'bar2');
  $set->rule('baz', sub {...}, \'cache');

is equivalent to

  $set->rule('foo1', sub {...}, 'bar1')
      ->rule('foo2', sub {...}, 'bar2');
  @cache = qw(bar1 bar2);
  $set->rule(@cache, sub {...}, 'baz');

The advantage of name is, that it allows you to delay the creation of the list up to the latest possible moment and dosen't clutter your program with it.

name returns a special object that carries the name of the transformation with it, allowing you to do method chaining.

add %ARGS

This is the internal method called by rule and pipeline to add a processing rule.

The keys for the arguments are:

  source       => arrayref of source items
  target       => arrayref of target filenames
  code         => coderef of the transformation to apply
  meta_targets => arrayref of meta-targets this rule also belongs to

ordered_targets

Returns all targets ordered in a fashion that, if the rules for each target are executed one after another, all targets will be up to date. Note that no check is made whether the code attached to a rule needs to be executed or not.

If you see the set of make rules as a partially ordered set, this function returns the set of rules in a partial order. The method used is to convert the partial order to a total order by comparing the addresses of code blocks in the case of incomparability.

make

Applies all rules in a correct order and executes the code for the rules associated with them where at least one prerequisite is newer than the target. Makes stuff happen.

force

Applies all rules in a correct order and executes the code associated with them. Makes stuff happen.

NAME

Make::PurePerl::Target::File - File target

NAME

Make::PurePerl::NamedRule - Very simple container for named rules

AUTHOR

Max Maischein, < corion at cpan.org >

SEE ALSO

ppmake, Algorithm::Dependencies, Tree::DAG_Node.