Beefy Boxes and Bandwidth Generously Provided by pair Networks Ovid
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Exception handling for Image::Magick

by Zaxo (Archbishop)
on Sep 05, 2004 at 12:42 UTC ( [id://388630]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Exception handling for Image::Magick

The conventional way of writing your first snippet is:

$err = $image->DoSomething or die "Can't do Something: ", $err;
Perhaps that is adequate and simpler than exception handling.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re^2: Exception handling for Image::Magick
by redlemon (Hermit) on Sep 05, 2004 at 12:58 UTC

    the problem here is that I::M methods return a non-empty string on failure. So that would be:

    $err = $image->DoSomething and die $err;

    But sometimes methods are *meant* to return someting and then you have to test agains context to see if it's an error or not.

    --
    Lyon

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://388630]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.