Oh, nearly forgot, you might need to fix your Perl installation so that it globs file names. See perldoc perlwin32 and implement the Wild.pm module.
One thing it can't do is include it's own offspring, because of the END_UNLIKELY used as a PRINT terminator. That's unlikely to be a requirement, though. Also make sure that the file you redirect the output to somewhere else so that isn't picked up by the script itself!
@rem = '--*-Perl-*-- @echo off perl "%~dpnx0" %1 %2 %3 %4 %5 %6 %7 %8 %9 goto endofperl @rem '; #!perl #line 8 use strict; print "\@rem = '--*-Perl-*--\n"; print "\@echo off\n"; print "perl \"%~dpnx0\" %1 %2 %3 %4 %5 %6 %7 %8 %9\n"; print "goto end_of_perl\n"; print "\@rem ';\n"; print "#!perl\n"; print "#line 8\n"; my @files=@ARGV; for my $file (@files) { open(INFILE, '<', $file); print "open (STDOUT, '>', \"$file\");\n"; print "print <<'EOT_UNLIKELY';\n"; while (<INFILE>) { die "Found EOT" if /^EOT_UNLIKELY/; print; } print "EOT_UNLIKELY\n"; } print "__END__\n"; print ":end_of_perl\n"; __END__ :endofperl
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Packaging files in a perl script
by belg4mit (Prior) on Aug 15, 2003 at 15:01 UTC | |
by PhilHibbs (Hermit) on Aug 16, 2003 at 00:14 UTC |