Question

recently I was installing some perl modules on my RHEL 5 with perl version 5.8.8 and all instalations went fine. I can see that the modules exist in the @INC but my TWiki site claims that it can't find them returning an error: Can't locate Net/LDAP.pm in @INC (a lot of paths which contain the modules) at TWiki.pm line xx. When I do perl -e 'use Net::LDAP'; it doesn't return anything which means perl can find that module. Also TWiki was configured corectly and works fine except the plugins that use specific modules I had to install, I've even added the paths to setLib.cfg just in case.

Edit:

which perl returns /usr/bin/perl

the shebang line of twiki/cgi-bin/view is #!/usr/bin/perl -wT

perl -MNet::LDAP -e 'print $INC{"Net/LDAP.pm"}, "\n";' returns:

/usr/lib/perl5/site_perl/5.8.8/Net/LDAP.pm

apache error logs show: [Tue Nov 16 10:53:47 2010] [error] [client 10.76.14.170] [Tue Nov 16 10:53:47 2010] view: INC /usr/lib/perl5/site_perl/5.8.8 at /usr/local/apache2/htdocs/twiki5_pdc/bin/view line 44. So it use's the correct path.

Was it helpful?

Solution 5

Ok the reason was most probably that I was installing the perl modules as root and they were not set executable for others so apache couldn't execute/use them.

OTHER TIPS

@INC is possibly different from your command line - either because you're using a different Perl interpreter binary, or other factors affecting @INC.

Check command line's @INC: perl -e 'print join(",", sort @INC);' - and compare to @INC printed in your Wiki's error that you mentioned.

You might have to add directories to your web server's Perl's @INC which are present in command line's ("how" depends on whether you're running under mod_perl or not).

What Apache thinks your INC path is and what your command-line Perl thinks your INC path are usually two completely different things. You may have to set the environment variable PERL5LIB in your Apache configuration.

I'm a big fan of TWiki/FOSwiki and have encountered this issue several times in the past.

  1. Do this (it works in a good number of cases):

    perldoc -l Net::LDAP
    

    If there is POD in the file, it will point you to the .pm. Even so, if it points you to a .pod file, the .pm is usually in the same directory.

  2. Then check that list after the @INC( and see if the path is in there. You will probably need to modify the environment that Apache runs in, because it probably will not be in there.


Since, that didn't work for you, this should:

perl -MNet::LDAP -e 'print $INC{"Net/LDAP.pm"}, "\n";'

If perl is actually loading it, that will tell you where it's loading it from.

Horses: Have you reviewed the installation guide to make sure that everything's configured correctly?

Zebras: edit bin/twiki_cgi and add right before $TWiki::engine->run():

warn "ENV $_ => $ENV{$_}" for sort keys %ENV;
warn "INC $_" for @INC;

grep your apache error log for the rows with ENV and INC. Look for ENV rows with PERL5LIB or PERLLIB. Check INC rows to make sure the directories containing your CPAN libraries are listed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top