Hi monks,

i tried to pack an older perl application having a lot of local modules using App::FatPacker::Simple. But when i tried to run the packed script, I got a "Can't locate Local/Foo/Bar.pm in @INC" error. By reducing the code step by step, I finally found out that the problem is caused by Exception::Class which is used for the exceptions. Small example:

File ./local/Local/Foo.pm

package Local::Foo; use strict; use warnings; sub foo_func { print("This is the Foo module\n"); } 1;

File ./local/Local/Exception.pm (note that the round parens and their content are commented out after Exception::Class.)

package Local::Exception; use strict; use warnings FATAL => 'all'; use Exporter 'import'; our @EXPORT = qw(throw_local); use Exception::Class #( # 'Local::Exception' => # { # description => 'My local exception', # alias => 'throw_local' # } #) ; 1;

File main.pl:

use strict; use warnings; use Local::Exception; BEGIN{ use Data::Dumper; print("\n>>>\n", Dumper(\@INC), "\n<<<\n"); } use Local::Foo; Local::Foo::foo_func();

The output (using Strawberry Perl 5.26) is as expected:

$VAR1 = [ bless( { 'Local/Exception.pm' => '#line 8 "main.fatpack.pl" package Local::Exception;use strict;use warnings FATAL=>\'all\';use Ex +porter \'import\';our@EXPORT=qw(throw_local);use Exception::Class ;1; ', 'Local/Foo.pm' => '#line 12 "main.fatpack.pl" package Local::Foo;use strict;use warnings;sub foo_func {print("This i +s the Foo module\\n")}1; ' }, 'FatPacked::41105272' ), '.\\local', 'C:/Strawberry-perl-5.26.3.1-64bit/perl/site/lib', 'C:/Strawberry-perl-5.26.3.1-64bit/perl/vendor/lib', 'C:/Strawberry-perl-5.26.3.1-64bit/perl/lib' ]; <<< This is the Foo module

It is also correct for Strawberry Perl 5.14, 5.38 and Perl 5.34 on Ubuntu. But if i remove the comment chars changing Local::Exception to:

package Local::Exception; use strict; use warnings FATAL => 'all'; use Exporter 'import'; our @EXPORT = qw(throw_local); use Exception::Class ( 'Local::Exception' => { description => 'My local exception', alias => 'throw_local' } ) ; 1;

Then i get:

>>> $VAR1 = [ 'C:/Strawberry-perl-5.26.3.1-64bit/perl/vendor/lib/Exception +/Class.pm', '.\\local', 'C:/Strawberry-perl-5.26.3.1-64bit/perl/site/lib', 'C:/Strawberry-perl-5.26.3.1-64bit/perl/vendor/lib', 'C:/Strawberry-perl-5.26.3.1-64bit/perl/lib' ]; <<< Can't locate Local/Foo.pm in @INC (you may need to install the Local:: +Foo module) (@INC contains: C:/Strawberry-perl-5.26.3.1-64bit/perl/ve +ndor/lib/Exception/Class.pm .\local C:/Strawberry-perl-5.26.3.1-64bit +/perl/site/lib C:/Strawberry-perl-5.26.3.1-64bit/perl/vendor/lib C:/S +trawberry-perl-5.26.3.1-64bit/perl/lib) at main.fatpack.pl line 59. BEGIN failed--compilation aborted at main.fatpack.pl line 59.

The structure that fatpacker adds to @INC is gone causing the error. Basically the same error i get for 5.14 and 5.34. It only works for Strawberry Perl 5.38. Seems that something has been fixed in Perl between 5.34 and 5.38.

Is this a known problem? Is there a workaround for older Perl versions? It would be best if it worked for 5.14, but I could live with 5.34 as well.


In reply to Why causes Exception::Class a fat-packed perl application to fail (but works with 5.38) by Darkwing

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.