hello monks,
today i was trying to get Image::Size::imgsize
working. i'm using a framework that does a use encoding 'utf8' at the beginning. imgsize() called on a jpeg
didn't return the size but said it couldn't find out the
image type.
i made up a simple reproducing script which shows that removing the use encoding fixes this:
# image.pm: package image; use strict; use warnings; use Image::Size (); my $img = "/tmp/test.jpg"; no encoding; # this doesn't help my ($x, $y, $i) = Image::Size::imgsize($img); print "$x,$y, $i\n"; 1; # image.pl: #!/usr/bin/perl use strict; use warnings; # comment out next line to get it working use encoding "utf8"; use image;
next i found out was that Image::Size is using AutoLoader.pm, and moving the jpegsize.al code into the module fixed it too. so this only seems to happen with files loaded with AutoLoader. i tried debugging jpegsize.al a bit and found out that there is a call of ord() in the subroutine that returns the correct value normally, but with use encoding 'utf8' it returns 65533 always.
so i'm not sure what happens there, but encoding.pm seems
to change the way how .al files work with filehandles.
i tried Devel::Peek to get more information but the strings
all looked okay.
now i wonder if this is a bug in AutoLoader.pm, or if it's
the way encoding.pm is used by me.
i would be glad for any hints.
update: moving the use encoding after use image fixes it, too (but this can't be a general solution).
update2: tried with perl 5.8.4 and 5.8.8
In reply to use encoding 'utf8' and AutoLoader by tinita
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |