On Aug 6, Dan Muey said:
>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:
That's because eval BLOCK still compiles the block at compile-time. You
want to use eval EXPR.
eval 'use Module ...; 1';
if ($@) { uh oh }
You can also use q{} instead of single quotes for more code-like
appearance.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
<stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
[ I'm looking for programming work. If you like my work, let me know. ]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]