Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Dancer app works until I run it with Plack::Handler::Apache2

by LittleJack (Beadle)
on Mar 31, 2022 at 22:38 UTC ( [id://11142580]=perlquestion: print w/replies, xml ) Need Help??

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

I took the path here: https://metacpan.org/dist/Dancer/view/lib/Dancer/Deployment.pod#Running-from-Apache-with-Plack but it refuses to start up.

The error complains about List::Util not exporting certain methods:

Error while loading /path/to/app/bin/app.psgi: "pairmap" is not exported by the List::Util module\n "pairgrep" is not exported by the List::Util module

Which seems to say to me that it's accessing a very old List::Util somehow?

The app works:

  • when run with plackup
  • when run as cgi

and a simple Perl script with use List::Util qw( pairmap ); works fine. The version of Perl used by app.psgi is fine with it. I asked CPAN to upgrade List::Util but it said it was current. Plack::Handler::Apache2 seems to be current but doesn't seem to export a $VERSION so that's moot.

Which perl and which libraries is my Apache (2.4.7) trying to use?

Replies are listed 'Best First'.
Re: Dancer app works until I run it with Plack::Handler::Apache2
by kcott (Archbishop) on Apr 01, 2022 at 04:31 UTC

    G'day LittleJack,

    From your post yesterday (Starting out with Dancer and falling at the first hurdle) you're using Dancer2. The link you've provided is for Dancer documentation; the Dancer2 equivalent is https://metacpan.org/dist/Dancer2/view/lib/Dancer2/Manual/Deployment.pod#With-Plack. I had a quick look and can't see any substantial differences; however, it's better to use the right version of the documentation.

    "Which perl and which libraries is my Apache (2.4.7) trying to use?"

    Either modify your app.psgi, or write a new one, which outputs various version (and perhaps other) information. A very rough, command line example:

    $ perl -e ' use List::Util; print "Perl version: $]\n"; print "List::Util version: $List::Util::VERSION\n"; ' Perl version: 5.034000 List::Util version: 1.56

    Other suggestions:

    • Check in your Apache logs for some hints.
    • Check which version of mod_perl or mod_perl2 you have installed.
    • Do you have any instances of Apache::* that should be Apache2::*.
    • Specify a minimum Perl version; e.g. 'use 5.020;'.
    • Specify a minimum List::Util version; e.g. 'use List::Util 1.29 qw{...};'.

    Note that I'm attempting to guess what your app.psgi and Apache config look like. Something more concrete from you would be helpful.

    — Ken

      The first version of perldoc which mentions 'pairmap' and 'pairgrep' is for Perl v5.20

      Well that might explain it because my default Perl is still on 5.18.

      But when I check my $List::Util::VERSION it's 1.62 so it should be fine.

      The mystery is somewhat solved when I use Apache2::Status, because Apache is loading some modules from /usr/local/lib/perl/5.18.2/ but some others from /usr/lib/perl/5.18/ where there is indeed an old List::Util.

      How do I convince Apache to load a newer one from a different directory?

Re: Dancer app works until I run it with Plack::Handler::Apache2
by hippo (Bishop) on Apr 01, 2022 at 08:55 UTC
    Which perl and which libraries is my Apache (2.4.7) trying to use?

    You can find out via the highly configurable Apache2::Status handler.


    🦛

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-20 02:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found