From: "Randy W. Sims" <[EMAIL PROTECTED]>
> On 2/12/2004 9:56 PM, Hari Fajri wrote:
> 
> > Do perl have handling error (exception) mechanism?
> > 
> > for example: java use : try{...} catch{...}
> 
> perl has pretty poor build-in exception handling 

I don't think "poor" is the right word. Simple or low-level would fit 
better. IMHO.

> which consists of
> executing some code in an eval{...} block and then check $@ to see if
> an error occured. 

Considering the fact that $@ doesn't have to be a string, but it can 
be an object it's actually rather powerfull. But you do not have a 
lot of syntax sugar around that by default.

> There are a couple of good modules that provide a
> very nice wrapper around the built-in mechanism. Probably the best is
> 'Error' which adds 'try', 'catch', and 'except' blocks. There are also
> Exception::Class, Exception and a bunch of others
> <http://search.cpan.org/search?query=exception>.

Yep, in Perl you can choose your sweets :-)

Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to