> HI howdy again! > > I forgot to ask: > > Whenever I've tried to do: > > eval { use module; }; > if($@) ..... > > It always fails and I can't trap it it to , say, try a > different module if it's not found or otherwise do anythign, > (like tell a web browser user they need a certain module for > it to work: > > print header(); > eval { use Monkey; }; > die "You need Monkey Module installed" if $@; > > will always give a 500 error because ethe header() > never gets printed because all the use statements are done > firat and fail first or something lkike that. > > Is there any way to accomplish the above exampl, IE eval a > use Module; statement > and be able to do something with that knowledge?
Here's a better example perhaps, I'd like the second one to say "nope" since CGInoexisty isn't installed: ([EMAIL PROTECTED](~):5)$ perl -e 'eval { use CGI; }; if(!$@) { print "Yup\n"; } else { print "nope\n"; }' Yup ([EMAIL PROTECTED](~):6)$ perl -e 'eval { use CGInoexisty; }; if(!$@) { print "Yup\n"; } else { print "nope\n"; }' Can't locate CGInoexisty.pm in @INC (@INC contains: /usr/libdata/perl/5.00503/mach /usr/libdata/perl/5.00503 /usr/local/lib/perl5/site_perl/5.005/i386-freebsd /usr/local/lib/perl5/site_perl/5.005 .) at -e line 1. BEGIN failed--compilation aborted at -e line 1. ([EMAIL PROTECTED](~):7)$ > > TIA > > Dan > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]