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

Re: apache2 passing PERL5LIB environment to cgi

by AndyZaft (Hermit)
on Jun 14, 2010 at 19:48 UTC ( [id://844718] : note . print w/replies, xml ) Need Help??


in reply to apache2 passing PERL5LIB environment to cgi

You could try "use lib <path>" inside the perl file and see if that works?
  • Comment on Re: apache2 passing PERL5LIB environment to cgi

Replies are listed 'Best First'.
Re^2: apache2 passing PERL5LIB environment to cgi
by Anonymous Monk on Jun 14, 2010 at 20:00 UTC

    I have a little test script that use the module

    #!/usr/bin/perl -w
    
    use lib "$ENV{HOME}/lib/perl5";
    use Unicode::String qw(utf8 latin1 utf16be);
    

    If I have "export PERL5LIB=~/lib/perl5" it works, and with commented out it does not work.

      That makes no sense. They should be equivalent. Both of the following should work, or both should fail.
      PERL5LIB= perl -e'use lib "$ENV{HOME}/lib/perl5"; use Unicode::String +qw(utf8 latin1 utf16be);' PERL5LIB=$HOME/lib/perl5 perl -e'use Unicode::String qw(utf8 latin1 ut +f16be);'

      Could you confirm or refute?

      Hmm, never used perl with apache without mod_perl before. Does it start a new perl instance on every cgi call? So at least you get response from the script right? I mean as HTML in a browser. When you print @INC after your use lib line, do you see your $HOME/lib/perl5 in there? Was just wondering if ENV{$HOME} actually would have the right path or would show up something like /home/nobody/lib/perl5 or /lib/perl5?
        Does it start a new perl instance on every cgi call?

        The definition of CGI is start a new instance on every call, read input (form data or whatever) from STDIN, read headers from %ENV, write output on STDOUT.