develooper Front page | perl.perl5.porters | Postings from October 1999

Re: Addition to @INC

From:
Tom Christiansen
Date:
October 20, 1999 13:37
Subject:
Re: Addition to @INC
Message ID:
199910202036.OAA05670@jhereg.perl.com
On Wed, 20 Oct 1999 15:32:01 -0500 (CDT)
    Ed Peschko <Ed_Peschko@csgsystems.com> wrote
    in <199910202032.PAA25417@foghorn.csgsystems.com>:

>How difficult would it be to add the path of the current working directory
>of the script itself into INC? I'm finding myself constantly doing the f<SNIP>
>hack:

>sub _dir 
>    { my $file = `which $0`; my ($dir) = ($file =~ m"(.*/)"); return($dir); }
>BEGIN { push (@INC, _dir($0)); }

>in my scripts to keep my scripts and modules in the same place. And I wo<SNIP>
>that there is a precedent, that '.' is already @INC, which is considerab<SNIP>
>secure than this proposal.

    use FindBin;
    use lib $FindBin::Bin;

--tom



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About