http://qs321.pair.com?node_id=890351


in reply to Re^2: Building a Mojolicious app with PAR::Packer
in thread Building a Mojolicious app with PAR::Packer

No line number confusion: abs_path was dying. Turns out that the failing test had nothing to do with it - the problem is caused due to an interference with PAR's runtime environment. Prepending a bit of code to the main script works around the problem:

use File::Spec; BEGIN { if ($ENV{'PAR_TEMP'}) { my $dir = File::Spec->catfile ($ENV{'PAR_TEMP'}, 'inc'); chdir $dir or die "chdir: '$dir': $!"; } }

We go to the parent directory of script so now it's properly detected.

--
 David Serrano
 (Please treat my english text just like Perl code, i.e. feel free to notify me of any syntax, grammar, style and/or spelling errors. Thank you!).

Replies are listed 'Best First'.
Re^4: Building a Mojolicious app with PAR::Packer
by Anonymous Monk on Mar 02, 2012 at 13:30 UTC
    Hello all. Did you alors experienced this kind of error messages with Mojo ? (Did'nt get rid of even while including or creating by hand the epl files)
    Can't open file "Mojolicious\templates\exception.html.ep": No such fil +e or directory at Mojo/Home.pm line 119. Compilation failed in require at Mojolicious.pm line 6. BEGIN failed--compilation aborted at Mojolicious.pm line 6. Compilation failed in require at Mojo/Base.pm line 32.
Re^4: Building a Mojolicious app with PAR::Packer
by Anonymous Monk on Mar 02, 2012 at 13:53 UTC

    Hello all.

    Did you also experience this kind of error messages with Mojo ? (Did'nt get rid of even while including or creating by hand the epl files)
    Can't open file "Mojolicious\templates\exception.html.ep": No such fil +e or directory at Mojo/Home.pm line 119. Compilation failed in require at Mojolicious.pm line 6. BEGIN failed--compilation aborted at Mojolicious.pm line 6. Compilation failed in require at Mojo/Base.pm line 32.

      One solution with PAR::Packer and pp.

      Add the following option to your compile command line :

      C:\strawberry\perl\bin\perl.exe "C:\strawberry\perl\site\bin\pp.bat" +--output="<your_script>.exe" --log="<your_script>.pp.log" --verbose=3 + --cachedeps="<somewhere_tmp>\ppcache" --info FileVersion="0.0.0.0" - +-info ProductVersion="0.0.0.0" --compress 6 --addfile="C:\strawberry\ +perl\site\lib\Mojolicious;Mojolicious" --bundle --save "<you_script>. +pl"