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

Re: %INC...

From:
Paul Schinder
Date:
April 29, 2000 17:12
Subject:
Re: %INC...
Message ID:
p04310100b5312a19a70a@[10.0.1.33]
At 3:09 PM -0400 4/29/00, Jeff Pinyan wrote:
>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'};
>
>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;

In MacPerl, it would actually be $INC{Some/Module.pm}, which would 
contain the full MacOS path to the module.

>     /os2/i and $OSSEP = '\\', last;
>   }
>   ($module = 'Some::Module.pm') =~ s/::/$OSSEP/g;
>   $loc = $INC{$module};
>
>But perhaps I'm being silly.
>
>--
>MIDN 4/C PINYAN, NROTCURPI, US Naval Reserve             japhy@pobox.com
>http://www.pobox.com/~japhy/                  http://pinyaj.stu.rpi.edu/
>PerlMonth - An Online Perl Magazine            http://www.perlmonth.com/
>The Perl Archive - Articles, Forums, etc.    http://www.perlarchive.com/

-- 
--
Paul Schinder
schinder@pobox.com



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