#!/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"; }
In reply to Re: How to keep a script from bombing due to a missing module?
by Nkuvu
in thread How to keep a script from bombing due to a missing module?
by yoda54
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |