Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: use or require ?

by Corion (Patriarch)
on Oct 01, 2007 at 08:51 UTC ( [id://641854]=note: print w/replies, xml ) Need Help??


in reply to use or require ?

Basically, you want:

(my $filename = $module) =~ s-::|'-/-g; $filename .= ".pm"; require $filename or die "Couldn't load '$filename': $!";

If you want this to be more equivalent to use, wrap it in a BEGIN block.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-03-28 13:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found