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

Thanks to all who have responded to my initial call for help - 'How To Add Path to @INC' The general concensus is to use - use lib '/path'; I've sort of gone inside to opensource ( symphero ) scripts and isolated something like 51 *.cgi files, 65 *.pl files and 54 *.PM files. The initial script that starts the ball rolling is cloneobject.cgi. The initial header of this file reads :- #!/usr/bin/perl # # Send errors to the browser and to a custom error log file # BEGIN { use CGI::Carp qw(carpout fatalsToBrowser); my $errfile = 'error_log'; open(LOG, ">>$errfile") or die "Unable to append to error log: $!\n"; carpout(*LOG); } use XaoSite; require 'commerce_configuration.pl' ; ## Based on advise and help that has been forwarded, would i have to go through all scripts and place the 'use lib' instruction ( where applicable ), inorder for the application to install. Or just once inside cloneobject.cgi. Once this instruction has been place and my designated path has been attached to @INC, I assume others on the ISP server will be able to see the attached path. I would prefer not to. Is there a way of avoiding other seeing or referencing it. Again, thanks to all who assist. Hansraj

Replies are listed 'Best First'.
Re: @INC Revisited
by Fastolfe (Vicar) on Jul 29, 2000 at 22:45 UTC
    You can always use relative paths here. E.g. use lib '..';

    Another poster also mentioned the viability of the PERLLIB environment variable to override the default @INC. This is not guaranteed to be secure, though, so it will not work if your CGI is using Taint checking (-T).

    As far as other users being able to examine your code and see where your libraries are, by seeing the use lib arguments or the value of @INC, I don't see what the big deal is. They can already see your code anyway.

    Regardless, with big projects, you really should use relative paths in your use lib statement, just so that it's portable. You can move your app elsewhere without having to re-do all of that. Application-specific/bundled libraries should be referenced via use lib.