On 1 Mar 2004 at 16:13, Tomas Doran wrote:

> What I'd like to be able to do is say something like the following:
> 
> Use PAR $0;
> 
This shouldn't be necessary.
> 
> However, as $0 is a pp packed executable (and not just a par file), this
> doesn't work.. Is there any cunning way to get round this / get acces to
> the raw .par file for a fully pp'd program?
> 
The cache of PAR files known to PAR::read_file already contains the PAR inside a pp'd 
program. The following program prints itself from inside the .exe without explicitly 
telling "use PAR;" about it. It also prints all of the PAR environment values and the 
contents of the PAR cache. You can see that the .exe is already in there.

----------------------
use PAR;

    my $stuff = PAR::read_file('script/t2.pl');
    print $stuff;
    print "\n\n";
    for (keys %ENV) {
       print "$_=$ENV{$_}\n" if /PAR/;
    }
    print "\n\n";
    for (keys %PAR::LibCache) {
       print "$_\t$PAR::LibCache{$_}\n";
    }
print "$0 done\n";
---------------------

Alan Stewart


Reply via email to