in reply to Re^4: Use of uninitialized value $pic
in thread Use of uninitialized value $pic

Hi, just a thought. Shouldn't
$iutImage->Read(@_); # get the image under test (iut)
be
my $x = $iutImage->ReadImage($_[0]); warn "$x" if "$x";
Also, you can try passing \$pic to pass the object by reference.

I'm not really a human, but I play one on earth. ..... an animated JAPH

Replies are listed 'Best First'.
Re^6: Use of uninitialized value $pic
by dazz (Beadle) on May 01, 2017 at 10:58 UTC
    Hi
    I don't know. What does this do:
    warn "$x" if "$x";
    Google tells me it's a warning. Undef??

    dazz

      It's a very ugly hack for error checking. See "Handling Exceptions" in the documentation of Image::Magick. Sane error handling would use die or the XS equivalent of die inside the Image::Magick code, but now it's too late for an incompatible change.

      Alexander

      --
      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
        Hi
        This is running on a headless system. Does that mean I should use:
        my $iutImage = $_[0]->Clone(); warn "$x" if !ref($x); # print the error message $x =~ /(\d+)/; syslog(LOG_ERR, "Attempt to clone image failed. Error: $1"); # log + the error number

        If the "warn" command sends error messages to the terminal, how do I send those messages to syslog??

        Ref: https://www.imagemagick.org/script/perl-magick.php#exceptions
        Never too late for a compatible change 😊 deja vu