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

[email protected] (Shlomi Fish) Sat, 17 Oct 2009 19:01:35 +0200
Newsgroups perl.perlfaq.workers
Message-ID <[email protected]>
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

On Friday 16 Oct 2009 18:37:20 Janine Goldstein wrote:
> 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       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.