in reply to how to include a directory in @INC?

Yes, but that makes things a little messy. Especially when trying to ( say ) upgrade your server. With the symlink method, all the local extensions stay in one nice little heap that can be easily moved.

Speaking from personal experience ( although it could be I am just disorganized ), I have tried both ways and I really like the method I suggested. It is easier to maintain, it is obvious in code when you are accessing the local extentions ( eg, use LOCAL::Module ) and just strikes me as cleaner.

Just my $0.02 worth

Mik Firestone ( perlus bigotus maximus )

  • Comment on Re: how to include a directory in @INC?

Replies are listed 'Best First'.
Re: Re: how to include a directory in @INC?
by snadra (Scribe) on Jun 26, 2003 at 11:18 UTC
    If you are root, you can add an @inc path to the /etc/profile aswell, so the path will be set for every user after booting.
    The entry could look like this:
    PERL5LIB="${PERL5LIB}:/home/snadra/my_modules"
    export PERL5LIB

    The problem is, this does not work with CGI, it is only recommandable for people who don't use CGI.
    You need to set $PERL5LIB then inside of the httpd.conf aswell, I think, but I have not tried that yet.

    Edit:
    I am using a symbolic link now. I put that link into one of the @inc paths.
    This is working recursively under Linux, so I can call my modules like:
    use Linked_Dir::Dir::Module;