Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: __FILE__ fails in app built with PAR::Packer

by Anonymous Monk
on Sep 10, 2011 at 22:38 UTC ( #925294=note: print w/ replies, xml ) Need Help??

in reply to __FILE__ fails in app built with PAR::Packer

See ppselfdoc.PL, PAR::Environment#PAR_0, perlsyn#Plain Old Comments (Not!)

What par ends up running is %PAR_TEMP%\

package main; shift @INC; #line 1 "script/" if (defined $ENV{PAR_APP_REUSE}) { warn "Executable was created without the --reusable option. See 'p +erldoc pp'.\n"; exit(1); } my $zip = $PAR::LibCache{$ENV{PAR_PROGNAME}} || Archive::Zip->new(__FI +LE__); my $member = eval { $zip->memberNamed('script/') } or die qq( Can't open perl script "script/__FILE__.925": No such file or directory ($zip)); PAR::_run_member($member, 1);


package main; shift @INC; #line 1 "script/" # works in plain perl # fails with this compilation line: # pp -P -r -v 99 -o BEGIN { use File::Spec; for (@INC) { if ( !ref $_ && -d $_ && !File::Spec->file_name_is_absolute($_ +) ) { $_ = File::Spec->rel2abs($_); } } } sub hello { my $file = __FILE__; warn "My file name is $file. Here is my contents:"; open(my $fh, "<", $file); my @data = <$fh>; warn "@data"; } hello(); 1;
Compare with %PAR_TMP%\inc\lib\
#line 1 "" package strict;

In an earlier par version it was

#line 1 "C:/perl/5.10.1/lib/" package strict;

So yeah, those #line number "file" directives have gotten out of sync with reality and evolved into uselessness, as have the values in %INC => /loader/HASH(0xaa240c)/

This decision isn't explained anywhere

I don't see any reason for those values not to be absolute paths, esp the %INC values

Comment on Re: __FILE__ fails in app built with PAR::Packer
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://925294]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (14)
As of 2015-11-30 22:39 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (788 votes), past polls