Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Testing for a module's presence

by vek (Prior)
on Feb 06, 2005 at 06:07 UTC ( [id://428450]=note: print w/replies, xml ) Need Help??


in reply to Testing for a module's presence

I usually do something like this early on in my code:

my $HAVE_MODULE = eval 'require Some::Module; 1' ? 1 : 0;
I can then react accordingly later on:
if ($HAVE_MODULE) { do_stuff(); } else { do_something_else(); }

-- vek --

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-04-18 08:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found