This is not a bug-report or a request for help, I am just sharing my
experience.
I install Mojolicious inside an app-local directory using cpanm's "-L"
switch:
.
|─- perl5/
| |-- bin/
| | |-- hypnotoad
| | |-- mojo
| | |-- morbo
| |-- lib/
| |-- perl5/
| |-- Mojo/
| |-- Mojo.pm
| |-- Mojolicious/
| |-- Mojolicious.pm
|-- script/
|-- app.pl
I run hypnotoad with Perl's "-I" flag to append my local-lib directory to
the beginning of @INC:
perl -Iperl5/lib/perl5 perl5/bin/hypnotoad ./script/myapp.pl
My app logs an error related to Mojolicious:
Can't locate object method "every_param" via package "Mojo::Parameters"
After investigating I realise that my "global" install of Mojolicious is
being loaded instead of my local one.
If I dump @INC at the beginning of the hypnotoad script, it produces this:
(
"/home/ac/apps/MyApp/perl5/bin/../lib",
"perl5/lib/perl5/i686-linux",
"perl5/lib/perl5",
"/home/ac/perl5/perlbrew/perls/perl-5.16.1/lib/site_perl/5.16.1/i686-linux",
"/home/ac/perl5/perlbrew/perls/perl-5.16.1/lib/site_perl/5.16.1",
"/home/ac/perl5/perlbrew/perls/perl-5.16.1/lib/5.16.1/i686-linux",
"/home/ac/perl5/perlbrew/perls/perl-5.16.1/lib/5.16.1",
".",
)
(
"/home/ac/apps/MyApp/perl5/bin/../lib",
"/home/ac/perl5/perlbrew/perls/perl-5.16.1/lib/site_perl/5.16.1/i686-linux",
"/home/ac/perl5/perlbrew/perls/perl-5.16.1/lib/site_perl/5.16.1",
"/home/ac/perl5/perlbrew/perls/perl-5.16.1/lib/5.16.1/i686-linux",
"/home/ac/perl5/perlbrew/perls/perl-5.16.1/lib/5.16.1",
".",
)
It appears that the process restarts itself, the second time without my
modified @INC.
Looking inside Mojo::Server::Hypnotoad, I notice this:
$ENV{HYPNOTOAD_EXE} ||= $0;
...
# Clean start (to make sure everything works)
die "Can't exec: $!" if !$ENV{HYPNOTOAD_REV}++ && !exec
$ENV{HYPNOTOAD_EXE};
So my workaround is to manually set the HYPNOTOAD_EXE environment variable:
export HYPNOTOAD_EXE="perl -Iperl5/lib/perl5 perl5/bin/hypnotoad"
perl -Iperl5/lib/perl5 perl5/bin/hypnotoad ./script/myapp.pl
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.