Subject: | Warnings while processing PNGs |
In Image/Info/PNG.pm, around line 61:
$last =~ s/\s(\d+)$//;
my $count = $1 || 1;
if ($last eq $type) {
$count++;
When the replace fails, garbage from an earlier match is put in $count, which can generate warnings on the increment when it is not a number.
In a particular situation, I got warnings like:
Argument ".png" treated as 0 in increment (++) at /home/jv/lib/perl5/Image/Info/PNG.pm line 64.
Trivial fix is appended.
Subject: | Image_Info_PNG.patch |
*** /usr/share/perl5/vendor_perl/Image/Info/PNG.pm 2014-12-19 22:56:15.000000000 +0100
--- lib/Image/Info/PNG.pm 2016-10-24 08:15:45.955054105 +0200
***************
*** 58,65 ****
if (@chunks) {
my $last = $chunks[-1];
! $last =~ s/\s(\d+)$//;
! my $count = $1 || 1;
if ($last eq $type) {
$count++;
$chunks[-1] = "$type $count";
--- 58,65 ----
if (@chunks) {
my $last = $chunks[-1];
! my $count = 1;
! $count = $1 if $last =~ s/\s(\d+)$//;
if ($last eq $type) {
$count++;
$chunks[-1] = "$type $count";