App-Templer
view release on metacpan or search on metacpan
bin/build-templer view on Meta::CPAN
#
#
# Add up each of these files to the generated script.
#
foreach my $file ( find_files() )
{
# Skip lib::Templer::Site::New
next if ( $file =~ /Templer\/Site\/New.pm$/ );
# Is this Templer::Site?
my $site = 0;
$site = 1 if ( $file =~ /Templer\/Site.pm$/ );
open( my $tmp, "<", $file ) or
die "Failed to open file - $file - $!";
while ( my $line = <$tmp> )
{
if ($site)
{
#
# We don't want to "use Templer::Site::Asset" or
# "use Templer::Site::Page" when running in standalone
# mode.
#
print $handle $line
unless ( $line =~ /use Templer::Site::(Asset|Page)/ );
}
else
{
print $handle $line;
}
}
close($tmp);
}
#
# Now add on "./bin/templer"
#
open( my $master, "<", "bin/templer" ) or
die "Failed to open bin/templer - $!";
while ( my $line = <$master> )
{
next if ( $line =~ /^require.*Templer.*/ );
print $handle $line;
}
close($handle);
#
# Make the file executable.
#
if ( $OSNAME eq 'MSWin32' )
{
#pl2bat is included by default in Strawberry and ActiveState Perl.
`pl2bat templer`; # Will wrap templer in a batch file named templer.bat.
}
else
{
chmod( 0755, "templer" );
}
#
# All done.
#
close($handle);
( run in 0.477 second using v1.01-cache-2.11-cpan-d7f47b0818f )