Skip Menu |

This queue is for tickets about the PAR-Packer CPAN distribution.

Report information
The Basics
Id: 53902
Status: resolved
Priority: 0/
Queue: PAR-Packer

People
Owner: Nobody in particular
Requestors: SWMCD [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.002
Fixed in: (no value)



Subject: The coderef in @INC returns a globref for non-existent files
pp installs a coderef in @INC. The func/require POD says of this coderef The subroutine should return undef or a filehandle, from which the file to include will be read. If undef is returned, require will look at the remaining elements of @INC. However the coderef installed by pp always returns a filehandle (actually, a globref), even if the require'd file doesn't exist. There are programs that depend on the documented behavior. For example, log4perl explicitly walks @INC looking for require'd files. It tests the return value of coderefs on @INC to decide whether a file exists; if it doesn't, it tries to require it under a different name. When the coderef returns a globref for a file that doesn't exist, this mechanism in log4perl breaks.
On Thu Jan 21 22:12:49 2010, SWMCD wrote: Show quoted text
> However the coderef installed by pp always returns a filehandle > (actually, a globref), even if the require'd file doesn't exist.
Can you give a specific example? A simple-minded test doesn't show this behaviour: $ pp -o foo.exe -e 'use Data::Dumper; print "INC = @INC\n"; for (@INC) { next unless ref $_ eq "CODE"; my $required = $_->($_, "Fooish/Bar.pm"); print "$_ => ", Dumper($required); }' $ ./foo.exe INC = /tmp/par-ccm_root/cache-155b9fe3b8219d39ccea2b862961b810cd5fab2d/inc/lib /tmp/par-ccm_root/cache-155b9fe3b8219d39ccea2b862961b810cd5fab2d/inc CODE(0xf13b50) CODE(0xf13e50) CODE(0xf13b50) => $VAR1 = undef; CODE(0xf13e50) => $VAR1 = undef;
I no longer see this problem either.