Hi Vyacheslav,

On Sun, 08 Apr 2012 15:10:06 +0000
Vyacheslav <agapov.sl...@gmail.com> wrote:

> Thanks all.
> 
> using eval helped me.
> 

The problem with eval in Perl 5 is that it catches any and all thrown exceptions
. I.e: by default, it doesn't do Object-Oriented exceptions like Java, Ruby,
Python and other languages do, though this can be done to a large extent
using some CPAN modules. As a result, by using eval, you risk easily trapping
other more meaningful exceptions, which *should* cause your program to
terminate.

In your case, you're throwing an exception explicitly upon failure, so if you're
not interested in an exception getting thrown, you should just handle the
failure differently.

( I also recall seeing something about excessive exceptions throwing and
trapping being costly in CPU time, but this shouldn't make a difference in this
case. )   

Regards,

        Shlomi Fish 

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Why I Love Perl - http://shlom.in/joy-of-perl

“Interesting” has a negative correlation with “successful”.
    — Anno on Freenode's #perl

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to