On Sun, 27 Jan 2013 10:30:38 -0600
Mike Flannigan <mikef...@att.net> wrote:

> 
> I have written some CGI applications that start
> with this code:
> 
> 
> BEGIN {
>      my $homedir = ( getpwuid($>) )[7];
>      my @user_include;
>      foreach my $path (@INC) {
>          if ( -d $homedir . '/perl' . $path ) {
>              push @user_include, $homedir . '/perl' . $path;
>          }
>      }
>      unshift @INC, @user_include;
> }
> 
> 
> I have failed to document exactly what this section
> is doing and would like to correct that.  Am I correct
> when I say that this code includes all the directories
> where Perl is located (C:/Perl in my case) in @INC, so
> there is little chance of not finding a module I have
> installed and am calling in this CGI script?

It's better to keep local modules under the same directory as the
script.

use FindBin qw( $RealBin );
use lib $RealBin;

See:
perldoc FindBin
perldoc lib


-- 
Don't stop where the ink does.
        Shawn

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to