!plake: # Denote "code" section, where we setup targets
# This is all just Perl code that gets eval'd...
my $START = "header base_section";
target(
default, # Target name
"$START section1 footer", # Sections to include
'path/to/output/file.pl' # Target output path
);
target(
section2,
"$START section2 footer",
'' # Output to STDOUT
);
!plake. # End section
This text will appear if "lazy/top-down" behavior is invoked -- that
is, any lines not specifically part of a section are allowed to be
output.
!plake header
HEADER: One liner section
!plake base_section:
... included in all assemblages ...
... etc ...
!plake section1:
... something, code, markup, comments, whatever ...
... more ...
... etc ...
!plake section2: # Start of this section denotes end of previous
... stuff ...
... more ...
... etc ...
!plake footer:
(c) 2999
####
use Plake qw(target my_builder);
# ... Open file...
# Parse
while() {
Plake::parse($_);
}
# Setup targets (and whatever else)
eval $Plake::CODE;
# Build a target. $src is the assembled content. $target is
# the path to the output file that should be created, if one
# is defined.
$stickler_mode = 'on';
my ($target, $src) = Plake::build('target_name', $stickler_mode);
# ... Now, do something with $target and $src ...
##
##
configfiles:
plake.pl file=/path/to/Config.plk target=default
plake.pl file=/path/to/Config.plk target=demo
##
##
!plake:
target('helowrld', "helowrld", '');
target('oneplus', "oneplus", '');
target('both', "helowrld oneplus", '');
!plake helowrld
print "helowrld\n";
!plake oneplus:
# Add value to one
print 1+3.14, "\n";
##
##
perl t\plakeval.pl file="t/plakeval.plk" target="helowrld"
helowrld
perl t\plakeval.pl file="t/plakeval.plk" target="oneplus"
4.14
perl t\plakeval.pl file="t/plakeval.plk" target="both"
helowrld
4.14