Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Mojolicious::Lite and PAR::Packer

by frazap (Monk)
on Apr 05, 2019 at 09:44 UTC ( [id://1232186]=note: print w/replies, xml ) Need Help??


in reply to Re: Mojolicious::Lite and PAR::Packer
in thread Mojolicious::Lite and PAR::Packer

I did -a 'test.conf;script/test.conf' in the call to pp: so my config file is in the script dir in the par archive. But it is not found there... it is searched in the file system not in the par archive.

I did try -a 'test.conf' that placed the file in the root folder of the archive but that didn't work either.

If I add

my $file; if ( $ENV{PAR_TEMP} ) { print $ENV{PAR_TEMP}, "\n"; $file = $ENV{PAR_TEMP} . "/inc/script/test.conf"; } else { $file = 'test.conf'; } my $config = plugin 'Config' => { file => $file };

That seems to pass. But I still got errors with

push @ARGV, qw( daemon -m production -l http://127.0.0.1:3000 );
That gives "Unknown command "daemon", ...". If I change to
push @ARGV, qw( $0 daemon -m production -l http://127.0.0.1:3000 );

That gives "Can't open Mojolicious/Commands.pm: No such file or directory at Mojo/Util.pm line 140"

Adding -M Mojolicious::Commands in the pp option does nothing.

I would like to run pp with the -x option but how is is feasible with Mojolicous::Lite ?

Replies are listed 'Best First'.
Re^3: Mojolicious::Lite and PAR::Packer
by frazap (Monk) on Apr 05, 2019 at 11:13 UTC
    Got it...

    with pp options:

    -l libeay32_.dll -l zlib1_.dll -l ssleay32_.dll -a 'test.conf;script/test.conf' -M Mojolicious::Plugin::** -M Mojolicious::** -M Mojo::**
    and the script
    use Mojolicious::Lite; use File::Spec; BEGIN { if(exists $ENV{PAR_TEMP}) { my $dir = File::Spec->catfile($ENV{PAR_TEMP}, 'inc'); chdir $dir or die "chdir `$dir' failed: $!"; push @ARGV, qw( daemon -m production -l http://127.0.0.1:3000 ); } } my $file; if ( $ENV{PAR_TEMP} ) { print $ENV{PAR_TEMP}, "\n"; $file = $ENV{PAR_TEMP} . "/inc/script/test.conf"; } else { $file = 'test.conf'; } my $config = plugin 'Config' => { file => $file }; get '/test'; if(exists $ENV{PAR_TEMP} && $^O eq "MSWin32") { system qw(start http://localhost:3000/test); } app->start; __DATA__ @@ test.html.ep <!DOCTYPE html> <html> <head><title><%=config->{text}%></title></head> <body> <h1><%=config->{text}%></h1> </body> </html>

    The packed archive works

    frazap

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1232186]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-23 23:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found