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

Hi,

i looked for answer to this on PM but found only this which is not what I need. I have a bunch of cgi-files (mod_perl), which use some modules. These modules are in their own directory. And there is a subdirectory that also contains modules.

Because this subdirectory is part of another project I develop, I'd like to symlink it with that. No problem, all file operations work as expected, but my cgi's now fail with

Can't locate SUB/blah.pm in @INC

What understanding of mechanisms deep down below is it that I'm missing?

Bye
 PetaMem
    All Perl:   MT, NLP, NLU

  • Comment on How to get use to follow symbolic links?

Replies are listed 'Best First'.
Re: How to get use to follow symbolic links?
by EvdB (Deacon) on Nov 06, 2003 at 11:45 UTC
    The regular @INC and mod_perl's @INC often differ slightly. Try:
    warn "\@INC is: ", join ( ', ', @INC );
    in both your normal .pl and from the failing CGI. If this is the problem put a use lib '/your/path/here'; into a script and then call it with PerlRequire.

    Another thought: is your apache chrooted in any way?

    Yet another thought: Check the permissions.

    --tidiness is the memory loss of environmental mnemonics

Re: How to get use to follow symbolic links?
by rdfield (Priest) on Nov 06, 2003 at 11:26 UTC
    Have you checked that @INC contains "/path/to/symlink"?

    rdfield

      Of course. It does. I also tested it with a regular pl-file. It works there. Must be something mod_perl/cgi specific. I don't know what...

      Bye
       PetaMem
          All Perl:   MT, NLP, NLU

        Ah, not quite what I meant - is it in the @INC inside mod_perl?

        From the guide:

        Regarding the setting of PerlPassEnv PERL5LIB in httpd.conf: if you turn on taint checks (PerlTaintCheck On), $ENV{PERL5LIB} will be ignored (unset). See the 'Switches -w, -T' section.
        so I generally use a startup file to set the @INC I need at runtime under mod_perl: http://perl.apache.org/docs/1.0/guide/config.html#The_Startup_File.

        rdfield