NAME
Janus::Sequence::Code - Load maintenence plugin code.
SYNOPSIS
use Janus::Sequence::Code;
my $code = Janus::Sequence::Code->load( '/code/file' );
my ( $alpha, $omega ) = $code->dump( 'alpha', 'omega' );
CODE
$STATIC may be defined with a true value - a hint that our variables in this package should have a static effect.
Also, the package must return a HASH of ARRAY of CODE indexed by stage names.
Top level HASH consists of ARRAYs indexed by sequence names. Each ARRAY consists of CODE indexed by stage names. i.e. ARRAY is a flattened HASH, which guarantees order of stage invocations.
METHODS
load( $file )
Load code from file. Returns object.
dump( @name )
Returns code identified by @name.
static()
Returns true if static hint is on, false otherwise.
EXAMPLE
use strict;
use Data::Dumper;
## hint: modifications on our variables persist through all sub calls.
our $STATIC = 1;
our ( $foo, $bar ) = qw( foo bar );
our %hash = ( foo => 1, bar => 1 );
return
(
alpha =>
[
foo => sub { print "$foo\n"; $bar = 'baz'; },
bar => sub { print "$bar\n"; $foo = 'bar'; delete $hash{foo}; }
],
omega =>
[
foo => sub { print "$foo\n"; },
bar => sub { print "$bar\n"; print Dumper \%hash },
]
);