Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
laziness, impatience, and hubris
 
PerlMonks  

Re: what would you like to see in perl5.12? (require $class)

by ikegami (Pope)
on Aug 22, 2007 at 19:24 UTC ( #634490=note: print w/ replies, xml ) Need Help??


in reply to what would you like to see in perl5.12?

my $class = 'HTTP::Request'; require $class;


Comment on Re: what would you like to see in perl5.12? (require $class)
Download Code
Re^2: what would you like to see in perl5.12? (require $class)
by ysth (Canon) on Aug 22, 2007 at 19:42 UTC
    This is a good idea. It's backwards incompatible (in the case where someone really wanted to search @INC for a file named 'HTTP::Request'), but it seems to me within the level of incompatibility that's acceptable for a full version number change. (Though YMMV.)

      Do you mean %INC? Changing %INC to match is not required, and I wasn't suggesting that it should be done. People who want to search %INC (or @INC) can continue to do the same class to path conversion they are already doing.

      But if you wanted to change %INC to class names, you could maintain compatibility with old scripts by placing both the class name and paths in %INC.

        No, I meant search @INC, like:
        $ echo 1 > Foo::Bar $ strace perl -e'require "Foo::Bar"' 2>&1 |grep Foo execve("/usr/bin/perl", ["perl", "-erequire \"Foo::Bar\""], [/* 38 var +s */]) = 0 stat64("/etc/perl/Foo::Bar", 0xbffcabac) = -1 ENOENT (No such file or +directory) stat64("/usr/local/lib/perl/5.8.8/Foo::Bar", 0xbffcabac) = -1 ENOENT ( +No such file or directory) stat64("/usr/local/share/perl/5.8.8/Foo::Bar", 0xbffcabac) = -1 ENOENT + (No such file or directory) stat64("/usr/lib/perl5/Foo::Bar", 0xbffcabac) = -1 ENOENT (No such fil +e or directory) stat64("/usr/share/perl5/Foo::Bar", 0xbffcabac) = -1 ENOENT (No such f +ile or directory) stat64("/usr/lib/perl/5.8/Foo::Bar", 0xbffcabac) = -1 ENOENT (No such +file or directory) stat64("/usr/share/perl/5.8/Foo::Bar", 0xbffcabac) = -1 ENOENT (No suc +h file or directory) stat64("/usr/local/lib/site_perl/Foo::Bar", 0xbffcabac) = -1 ENOENT (N +o such file or directory) stat64("./Foo::Bar", {st_mode=S_IFREG|0644, st_size=2, ...}) = 0 open("./Foo::Bar", O_RDONLY|O_LARGEFILE) = 3

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://634490]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (11)
As of 2014-04-17 15:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (451 votes), past polls