in reply to How to keep a script from bombing due to a missing module?
#!/usr/bin/perl use strict; eval { require foo::bar }; # errors stored into $@ warn $@ if $@; # also, you can set a flag to see if the module # was available: my $use_foo_bar = 1 unless $@; print "I'm still going...\n"; if ($use_foo_bar) { foo::bar::function(); } else { print "No foo for you\n"; }
|
|---|