Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I catch "Can't locate <module>.pm" errors at runtime?

1 view
Skip to first unread message

Janine Goldstein

unread,
Oct 16, 2009, 12:37:20 PM10/16/09
to perlfaq...@perl.org
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

Shlomi Fish

unread,
Oct 17, 2009, 1:01:35 PM10/17/09
to perlfaq...@perl.org, Janine Goldstein
Hi Janine!

I'm sorry to disappoint you, but this is not the appropriate mailing list to
ask for technical help with some Perl code. Instead, it is intended for
working and enhancing the perl F.A.Q., which you are welcome to read here:

http://faq.perl.org/

There's another FAQ (this time for Freenode's #perl channel) here, which may
also prove of interest:

http://perl.net.au/wiki/Freenode_Sharp_Perl_FAQ

A mailing list you are looking for can be found here:

http://perl-begin.org/mailing-lists/

Feel free to still stay subscribed to this list and contribute.

Regards,

Shlomi Fish

--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
The Case for File Swapping - http://shlom.in/file-swap

Chuck Norris read the entire English Wikipedia in 24 hours. Twice.

0 new messages