Subject: | read/open method should work as class methods. |
Currently to read a single image file you do:
my $im = Imager->new;
$im->read(file => $foo) or die;
a common mistake is to skip the error check:
my $im = Imager->new;
$im->read(file => $foo);
which still leaves a non-null image in $im, even if the low level image
object is missing.
To reduce useless boilerplate, it should be possible to call read() as a
class method which returns nothing on failure:
my $im = Imager->read(file => $foo)
or die;
In this case, even if the error checking is ommitted, the error is
obvious the next time a method is called on $im:
my $im = Imager->read(file => $foo);
$im->write(file => $bar); # immediate BOOM, since $im is undef
Note that read_multi() is already a class method.