develooper Front page | perl.perl5.porters | Postings from March 2012

Re: pop @INC (".")

Thread Previous | Thread Next
From:
H.Merijn Brand
Date:
March 8, 2012 22:56
Subject:
Re: pop @INC (".")
Message ID:
20120309075621.4a2fafbd@pc09.procura.nl
On Thu, 8 Mar 2012 17:06:10 -0600, Reini Urban <rurban@x-ray.at> wrote:

> On Thu, Mar 8, 2012 at 4:37 PM, Todd Rinaldo <toddr@cpanel.net> wrote:
> > On Mar 8, 2012, at 2:58 PM, Jan Dubois wrote:
> >> On Thu, 08 Mar 2012, David Golden wrote:
> >>> Let me answer your points in reverse order.
> >>>
> >>>> Does anyone besides me share my concern that putting "." in the path
> >>>> isn't always necessarily desirable?
> >>>
> >>> I agree that it's not always desirable, but I'm not convinced that
> >>> it's never desirable, either. Or rather, if undesirable, how/when
> >>> should it be removed from @INC. Optionally with "-T" or mandatory
> >>> enforcement by the interpreter?
> >>
> >> I find it always undesirable.  What I usually want is mylib.pm,
> >> and '.' in @INC does provide similar functionality while testing
> >> from inside the script directory:
> >>
> >>    http://search.cpan.org/dist/mylib/mylib.pm
> >>
> >> If I really wanted '.' in @INC, then -I. is a cheap commandline
> >> option, or "BEGIN { push @INC, '.' }" a trivial script addition.
> >>
> >> But as I already said, I never really want '.' in @INC, I either
> >> want $FindBin::RealBin, or the directory pushed by mylib.pm.
> >>
> >> So I think a Configure option to build perl without '.' in @INC
> >> would be fine (and core tests should be updated to accommodate that),
> >> but a forced -T does not feel right to me.
> >
> > Jan says it better than me. This is my thinking.
> 
> Mine also.
> 
> . in @INC looks like a window-ism, where exe's are found in . before
> looking at %PATH, and . included in $PATH is considered bad style.

Yes, but extremely handy when *testing* in a different environment.

Not everybody uses the same MO, but I start an editor for every file I
edit and close it when I'm done. Others open their fav editor when they
have booted their machine and use that for every edit and never ever
close it. Some use all their windows maximized I never ever maximize a
window (unless in presentations where my browser supports F11 to show
full screen). Some start a single (x)term for doing all their work, I
start one for every task and close it when I'm done.

In that last case, it is very very handy to set PATH to include '.',
set $LD_LIBRARY_PATH, $SHLIB_PATH and other environment variables that
would make life miserable when I would have set them by default.

Having '.' in @INC is something I rely upon. There are many many
scripts scattered around in these test environments that have a .pm in
the current folder that is shared by a few scripts and that is there
only to share some code for the current task at hand. No need or wish
to have them installed anywhere.

I have never (yet) used 'mylib', and declaring '.' as a poor-man's '.'
is imho overstating the "problem" at hand.

-- 
H.Merijn Brand  http://tux.nl   Perl Monger  http://amsterdam.pm.org/
using perl5.00307 .. 5.14   porting perl5 on HP-UX, AIX, and openSUSE
http://mirrors.develooper.com/hpux/        http://www.test-smoke.org/
http://qa.perl.org   http://www.goldmark.org/jeff/stupid-disclaimers/

Thread Previous | Thread Next


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