dotReader
view release on metacpan or search on metacpan
inc/dtRdrBuilder/Accessory.pm view on Meta::CPAN
use Archive::Zip ();
use File::Find;
my @book_bits;
find(sub {
if(-d $_ and m/\.svn/) {
$File::Find::prune = 1;
return;
}
(-f $_) or return;
m/^\./ and return;
#warn "found $File::Find::name\n";
push(@book_bits, $File::Find::name);
}, $pdir . $book);
# skip it if we've got one, see
if($self->up_to_date(\@book_bits, $destfile)) {
warn "$destfile is up-to-date\n";
next;
}
my $zip = Archive::Zip->new();
foreach my $bit (@book_bits) {
my $string = do {
open(my $fh, '<', $bit) or die "ack '$bit' $!";
binmode($fh);
local $/;
<$fh>;
};
my $bitname = $bit;
$bitname =~ s#.*$book/+##;
$zip->addString($string, $bitname);
}
warn "making $book.jar\n";
$zip->writeToFileNamed( $destfile ) == Archive::Zip::AZ_OK
or die 'write error';
}
} # end subroutine ACTION_books definition
########################################################################
=item compile
=cut
sub ACTION_compile {
my $self = shift;
# This line of thought has basically been dropped. Nice in theory,
# but terribly messy in practice.
die "nope";
# XXX use find_pm_files instead?
#my %map = $self->_module_map;
my $files = $self->find_pm_files;
#basically: $ perl -MO=Bytecode,-H,-oblib/lib/dtRdr.pmc -Ilib lib/dtRdr.pm
while (my ($file, $dest) = each %$files) {
my $to_path = File::Spec->catfile($self->blib, $dest);
if($file =~ m/dtRdr\/HTML/) { # these are too touchy
$self->copy_if_modified(from => $file, to => $to_path);
next;
}
# nice to have somewhere to go
File::Path::mkpath(File::Basename::dirname($to_path), 0, 0777);
next if $self->up_to_date($file, $to_path); # Already fresh
my @command = (
"-MO=Bytecode,-b,-H,-o$to_path", '-Ilib', $file
);
$self->run_perl_command(\@command);
}
} # end subroutine ACTION_compile definition
########################################################################
=back
=cut
1;
( run in 1.471 second using v1.01-cache-2.11-cpan-5a3173703d6 )