Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
Welcome to the Monastery
 
PerlMonks  

Re^3: stronger than eval?

by ikegami (Patriarch)
on Sep 21, 2006 at 17:30 UTC ( [id://574272]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re^2: stronger than eval?
in thread stronger than eval?

I see that as a plus, since it probably doesn't make sense to import from something which is conditionally imported. However, it's not hard to import if so desired.

BEGIN { eval { require Cache::File } or warn("Proceeding without Cache::File\n"); Cache::File->import(qw( ... )) if Cache::File->can("import"); }

or

BEGIN { my @imports = qw( ... ); eval "use Cache::File \@imports" or warn("Proceeding without Cache::File\n"); }

The BEGIN ensures prototypes are properly loaded.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://574272]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.