Front page | perl.perl5.porters |
Postings from October 1999
Re: Addition to @INC
From:
Nick Ing-Simmons
Date:
October 20, 1999 21:12
Subject:
Re: Addition to @INC
Message ID:
E11eAWo-0005gy-00@serv1.is1.u-net.net
Ed Peschko <Ed_Peschko@csgsystems.com> writes:
>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 following
>hack:
>
>sub _dir
> { my $file = `which $0`; my ($dir) = ($file =~ m"(.*/)"); return($dir); }
>BEGIN { push (@INC, _dir($0)); }
The FindBin module supplies support for that.
If you look at the module (which is one of Graham's and all Perl) you
will see it is surprisingly messy. I for one would not want that
overhead in every script. The real pain is the `which $0` equivalent
which involves a bunch if stat()s which are quite time consuming.
>
>in my scripts to keep my scripts and modules in the same place. And I would say
>that there is a precedent, that '.' is already @INC, which is considerably less
>secure than this proposal.
>
>Ed
--
Nick Ing-Simmons