Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re^3: Conditionally faking a module

by bobf (Monsignor)
on Jan 13, 2010 at 19:14 UTC ( #817262=note: print w/replies, xml ) Need Help??

in reply to Re^2: Conditionally faking a module
in thread Conditionally faking a module

Apparently it may not always work, as I learned when I researched this further (see RE: Checking to see if a particular Module is installed). merlyn's response was to use the following:

eval 'require GD'; if ($@) { # problems with GD, fall back to non-GD } else { # we have GD, go for it! }
although there appears to be some caveats to that approach.

If you are open to using other modules to do the check, you could look into ExtUtils::Installed and Module::Load::Conditional.

See also a recent thread on this topic: Check if module is installed.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://817262]
[Tux]: choroba++ # pm_cb_g also signals replies to posts, something#cbstream does not
[marto]: good afternoon all
[marto]: that is a neat feature, I'll have to have a look at how it displays that
[Tux]: 14:32 Europe/Amsterdam, so good afternoon to you :)
[marto]: 13:32, sunny Glasgow :P
[Tux]: as in, some others might appreciate a good morning or goor evening
[Tux]: Glasgow, as in TPCiG-2018 !!!! :) :)
erix would rather appreciate proof of a goodmorning
[marto]: Tux so I'm told :)

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (8)
As of 2017-09-22 12:38 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (263 votes). Check out past polls.