Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Pixel setting oddity - Image:Magick

by afoken (Chancellor)
on May 11, 2015 at 12:30 UTC ( [id://1126308]=note: print w/replies, xml ) Need Help??


in reply to Re: Pixel setting oddity - Image:Magick
in thread Pixel setting oddity - Image:Magick

Aren't you getting any warnings for that? I'm surprised Image::Magick doesn't complain about the invalid input.

The posted code has a bare string eval without any error checks ($@), so most errors will be silent. Also, Image::Magick requires a lot of manual error checks because it does not use perl's exception mechanism (i.e. die), but instead requires checking return values (as in C). This is documented in http://www.imagemagick.org/script/perl-magick.php#exceptions. The posted code lacks those checks, too.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
  • Comment on Re^2: Pixel setting oddity - Image:Magick

Replies are listed 'Best First'.
Re^3: Pixel setting oddity - Image:Magick
by Eily (Monsignor) on May 11, 2015 at 12:42 UTC

    Thanks for the info on exception handling with Image::Magick!

    And yes, merrymonk fails to check $@ after the eval, but there wouldn't have been a warning there since this actually works (as in this case the variables are actually in a double quote context). And on the topic of safety and error checking, it does look like the code is not run under strict and warnings ; which would have done nothing for this particular case, but are still very helpful safety nets.

      Thank you for that explanation. Indeed is was the single quotes that were stopping it working. When I changed these to 4 double quotes all was well!
        Indeed is was the single quotes that were stopping it working. When I changed these to 4 double quotes all was well!

        It may work, but it still hides most, if not all errors, because you don't check $@ after eval and you don't check the return values from Image::Magick.

        Alexander

        --
        Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1126308]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2024-04-23 07:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found