Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Testing for a module's presence

by DrHyde (Prior)
on Feb 07, 2005 at 10:52 UTC ( [id://428621]=note: print w/replies, xml ) Need Help??


in reply to Testing for a module's presence

If you just want to know whether it exists you have little choice but to grovel over @INC.

If you try to eval "use Some::Module" then the module will be loaded and any side-effects it has (such as exporting) will happen.

I suppose if you were feeling particularly crazy you could try something like this ...

print 'the module exists' if(!system("perl -MSome::Module -e exit"));
but if I saw code like that in production I'm afraid I'd have to shoot you.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-03-29 11:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found