http://www.perlmonks.org?node_id=1007336

elef has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to pack some modules with App::FatPacker on a Ubuntu 12.4 VM with perl 5.14.2, and I'm running into what looks like a bug in the module.

The first command in the fatpacker synopsis (fatpack trace myscript.pl) runs without error. When I run fatpack packlists-for `cat fatpacker.trace` >packlists, I get the following error message: Use of uninitialized value $_ in hash element at /usr/local/share/perl/5.14.2/App/FatPacker.pm line 110, <> line 42.

Line 110 of FatPacker.pm is this: my %found; @found{map +($pack_rev{$INC{$_}}||()), @targets} = ();

It's part of this sub:

sub packlists_containing { my ($self, $targets) = @_; my @targets = @$targets; require $_ for @targets; my @search = grep -d $_, map catdir($_, 'auto'), @INC; my %pack_rev; my $cwd = cwd; find(sub { return unless $_ eq '.packlist' && -f $_; $pack_rev{$_} = $File::Find::name for lines_of $File::Find::name; }, @search); chdir($cwd) or die "Couldn't chdir back to ${cwd} after find: $!"; my %found; @found{map +($pack_rev{$INC{$_}}||()), @targets} = (); sort keys %found; }
This is just too tricky for me to troubleshoot. Should I install an earlier version of Ubuntu (years ago, I managed to get App::FatPacker to work on Ubuntu 8.04)?

EDIT:

I did some further testing. A test script that does not load any CPAN modules was processed by fatpacker without errors. The packed script was generated correctly.

The actual script I need to process loads Spreadsheet::WriteExcel and Spreadsheet::ParseExcel::Simple, so these are the two modules fatpacker would need to inline.

The fatpacker.trace file is as follows:

POSIX.pm List/Util.pm Spreadsheet/ParseExcel/Cell.pm /usr/lib/perl/5.14/auto/POSIX/load_imports.al Tie/Hash.pm Cwd.pm Spreadsheet/WriteExcel/OLEwriter.pm Spreadsheet/ParseExcel.pm Fcntl.pm Symbol.pm Spreadsheet/WriteExcel/Chart.pm Scalar/Util.pm Spreadsheet/ParseExcel/Format.pm Spreadsheet/WriteExcel/BIFFwriter.pm File/Spec.pm File/Glob.pm warnings/register.pm Spreadsheet/ParseExcel/Workbook.pm Spreadsheet/ParseExcel/Utility.pm Spreadsheet/WriteExcel/Properties.pm utf8.pm Spreadsheet/WriteExcel/Worksheet.pm File/Spec/Unix.pm Exporter/Heavy.pm vars.pm Spreadsheet/WriteExcel/Formula.pm Spreadsheet/WriteExcel/Workbook.pm AutoLoader.pm IO/Handle.pm Getopt/Long.pm SelectSaver.pm Spreadsheet/ParseExcel/Worksheet.pm Time/Local.pm Spreadsheet/ParseExcel/Font.pm unicore/Heavy.pl unicore/To/Fold.pl Spreadsheet/WriteExcel.pm /usr/lib/perl/5.14/auto/POSIX/autosplit.ix OLE/Storage_Lite.pm FindBin.pm IO/Seekable.pm File/Copy.pm Spreadsheet/WriteExcel/Format.pm threads.pm Digest/Perl/MD5.pm File/Basename.pm Config.pm integer.pm IO.pm if.pm Carp.pm Crypt/RC4.pm FileHandle.pm Spreadsheet/ParseExcel/Simple.pm utf8_heavy.pl constant.pm Spreadsheet/ParseExcel/FmtDefault.pm overload.pm IO/File.pm feature.pm