G'day mldvx4,
As I'm not a user of Image::Magick, I left responses to those with more knowledge;
however, I see after two days you still have no resolution, so here's some suggestions.
Image::Magick has minimal documentation
and points to "PerlMagick Image API for Perl".
That appears to be rather dated ("Copyright © 1999") and has Perl code of a similar vintage.
It has various issues such as no I/O exception handling and use of a package variable for a filehandle.
It looks like your posted code is based on this.
I'd probably write it more like this:
#!/usr/bin/perl
use strict;
use warnings;
use autodie; # for I/O exception handling
use Image::Magick;
my $svg_filename = '/path/to/some.svg';
my $image = Image::Magick::->new();
open my $fh, '<', $svg_filename;
my $err = $image->Read(file => $fh);
if ($err) {
print "Error b: $err\n";
exit 1;
}
close $fh; # moved after any code related to $fh
print "OK\n";
exit 0;
You said: "I gave it a try and switched from using a file handle to using just a file name ...".
I don't know how you implemented that in code; I've used both a filehandle ($fh) and a filename ($svg_filename).
Do note that is untested code: I don't have Image::Magick installed.
|