Skip Menu |

This queue is for tickets about the App-FatPacker CPAN distribution.

Report information
The Basics
Id: 78391
Status: resolved
Priority: 0/
Queue: App-FatPacker

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

Bug Information
Severity: Important
Broken in: 0.009007
Fixed in: (no value)



Subject: packlists-for crashes when modules change $_ when required
This is biting Digest::Perl::MD5's code generation in particular, but a simpler example is: $ cat > A.pm package A; while (<DATA>) { # do nothing } 1; __DATA__ ^D $ packlists-for A.pm I get a result of: Use of uninitialized value $_ in hash element at .../perl-5.16.0/lib/site_perl/5.16.0/App/FatPacker.pm line 110, <> line 10. BEGIN failed--compilation aborted at .../perl-5.16.0/bin/fatpack line 3, <> line 10. The culprit is the packlists_containing method. It loads all of the target packages with: require $_ for @targets; If a module (like Digest::Perl::MD5) modifies $_ then @targets gets modified too. This can be fixed by just golfing less and making a local copy of the target to be required: for my $package_name (@targets) { require $package_name; }
Subject: fatpacker.patch
diff --git a/lib/App/FatPacker.pm b/lib/App/FatPacker.pm index 62a1612..773d8ae 100644 --- a/lib/App/FatPacker.pm +++ b/lib/App/FatPacker.pm @@ -102,7 +102,9 @@ sub script_command_packlists_for { sub packlists_containing { my ($self, $targets) = @_; my @targets = @$targets; - require $_ for @targets; + for my $package_name (@targets) { + require $package_name; + } my @search = grep -d $_, map catdir($_, 'auto'), @INC; my %pack_rev; my $cwd = cwd;
Fixed in 0.9.8