develooper Front page | perl.perl5.porters | Postings from April 2000

Re: %INC...

Thread Previous
From:
Nick Ing-Simmons
Date:
April 29, 2000 13:06
Subject:
Re: %INC...
Message ID:
E12ldVa-0005UQ-00@mserv1b.u-net.net
Jeff Pinyan <japhy@pobox.com> writes:
>Would it be sensible to patch %INC such that keys could also be package
>names?  This way, I can do:
>
>  use Some::Module;
>  $loc = $INC{'Some::Module'};

Why do you need to know location - i.e. what are you going to do 
with result?

>
>instead of doing:
>
>  use Some::Module;
>  $OSSEP = '/';
>  for ($^O || do { require Config; $Config::Config{osname} }) {
>    /Win/i and $OSSEP = '\\', last;
>    /^MacOS$/i and $OSSEP = ':', last;
>    /os2/i and $OSSEP = '\\', last;
>  }
>  ($module = 'Some::Module.pm') =~ s/::/$OSSEP/g;
>  $loc = $INC{$module};
>
>But perhaps I'm being silly.

I am not sure, but I thought %INC used '/' in its key names regardless of OS.




-- 
Nick Ing-Simmons


Thread Previous


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