How do I catch "Can't locate <module>.pm" errors at runtime?
[email protected] (Janine Goldstein) Fri, 16 Oct 2009 10:37:20 -0600
| Newsgroups | perl.perlfaq.workers |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I am a newby to perlfaq. Please let me know if I am emailing the wrong
group. Thanks.
I have some code that uses a Perl module and I would like to catch the error
"Can't locate <module>.pm in @INC" at runtime, give use user an error
message telling them they need to run the code on a different machine,
and exit gracefully.
I have tried:
no warnings FATAL
eval {use <module>}; warn $@ if $@;
BEGIN {$SIG{"__WARN__"} = sub {...};
try {use <module>;} catch {...};
all to no avail. Am I messing up the syntax or is there something more
fundamental going on?
Thanks for any and all help!!!!
Janine