in reply to How to keep a script from bombing due to a missing module?

With eval and require you can check if a certain module is available or not. If it is, you can use it, if it isn't, you may decide on going an alternative path at runtime, like this:
eval { require SomeModule; }; if($@) { print "SomeModule not found, doing something else\n"; } else { SomeModule->do_something; }

Replies are listed 'Best First'.
Re: Re: How to keep a script from bombing due to a missing module?
by eyepopslikeamosquito (Archbishop) on May 22, 2004 at 10:05 UTC