Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Checking to see if a particular Module is installed

by jimt (Chaplain)
on Aug 11, 2000 at 21:58 UTC ( [id://27559]=note: print w/replies, xml ) Need Help??


in reply to Checking to see if a particular Module is installed

My approach has always been:
BEGIN { eval "use GD"; $can_GD = 1 unless $@; };
Or something along those lines. Almost indistinguishable from the previous posts, admittedly, but I always try to be careful to wrap it up in BEGIN blocks. That way you're sure that the import is actually done at compile time instead of run time and it's virtually indistinguishable from an actual use.

So you don't need to worry about functions not be prototyped or whatnot.

Replies are listed 'Best First'.
RE: Re: Checking to see if a particular Module is installed
by tye (Sage) on Aug 11, 2000 at 22:06 UTC

    Actually, you probably still need to worry about that (be sure to test your code without the GD module installed). Most of the things I find useful about doing the import at compile time can't be easily used if you want to support the possible lack of the module. See my other nodes in this thread for more info.

            - tye (but my friends call me "Tye")

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-04-20 03:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found