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

Hello All,

I'm in the process of untainting a fairly large cgi program and have run into this problem when I try to load a Module I wrote just for the program. The module itself is located in its own library directory and is usually called by doing something like:

use lib './'; use LIB::MYMODULE;

but it seems when I turn tainting on, I get this wonderful little tidbit:

Can't locate LIB/MYMODULE.pm in @INC (@INC contains: /usr/libdata/perl +/5.00503/mach.... yadda yadda) not listing my directory, of couse,
some things I've tried, adding the path to the $ENV{PATH}, doing something like this:
BEGIN{ $lib = '/usr/home/justin/www/LIB'; push(@INC, $lib); }

What am I missing?

also, any suggestions/insight on converting a large program to use taint checking is appreciated.

 

-justin simoni
!skazat!

Replies are listed 'Best First'.
Re: Taint and Module q
by runrig (Abbot) on Jan 04, 2001 at 11:50 UTC
    Look at lib.

    I'm assuming MYMODULE.pm is in '/usr/home/justin/www/LIB'. Then:
    use lib qw(/usr/home/justin/www); use LIB::MYMODULE;
    If the package is actually called 'LIB::MYMODULE' then I'd do it as above. If the package name is just 'MYMODULE' (and you keep all your modules in the LIB directory) then I'd:
    use lib qw(/usr/home/justin/www/LIB); use MYMODULE;
Re: Taint and Module q
by davorg (Chancellor) on Jan 04, 2001 at 13:46 UTC

    Setting @INC using relative paths can cause problems if your script isn't run from the correct directory.

    You might like to look at the FindBin module which is part of the standard Perl installation.

    --
    <http://www.dave.org.uk>

    "Perl makes the fun jobs fun
    and the boring jobs bearable" - me