Skip Menu |

This queue is for tickets about the Image-ExifTool CPAN distribution.

Report information
The Basics
Id: 123472
Status: resolved
Priority: 0/
Queue: Image-ExifTool

People
Owner: Nobody in particular
Requestors: ishigaki [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 10.80



Subject: Not enough arguments for Time::Piece::_strptime error
Hi. According to the Changes, Image::ExifTool has been supporting Time::Piece since 10.32, but it spits an error "Not enough arguments for Time::Piece::_strptime" if Time::Piece is actually loaded (when POSIX::strftime is not available), because of the difference of the number of subroutine arguments. To reproduce the issue, add "use Time::Piece;" at the beginning of t/Writer.t and run it under an environment without POSIX::strftime. To fix this, replace Time::Piece::_strftime(...) in lib/Image/ExifTool/Writer.pl with Time::Piece->strftime(...), as the following patch. --- a/lib/Image/ExifTool/Writer.pl +++ b/lib/Image/ExifTool/Writer.pl @@ -4334,7 +4334,7 @@ sub InverseDateTime($$;$$) if ($hasStrptime == 1) { @a = POSIX::strptime($val, $fmt); } else { - @a = Time::Piece::_strptime($val, $fmt); + @a = Time::Piece->strptime($val, $fmt); } if (defined $a[5] and length $a[5]) { $a[5] += 1900; # add 1900 to year Cheers
On Wed Nov 01 13:52:30 2017, ISHIGAKI wrote: Show quoted text
> Hi. According to the Changes, Image::ExifTool has been supporting > Time::Piece since 10.32, but it spits an error "Not enough arguments > for Time::Piece::_strptime" if Time::Piece is actually loaded (when > POSIX::strftime is not available), because of the difference of the > number of subroutine arguments. > > To reproduce the issue, add "use Time::Piece;" at the beginning of > t/Writer.t and run it under an environment without POSIX::strftime. > > To fix this, replace Time::Piece::_strftime(...) in > lib/Image/ExifTool/Writer.pl with Time::Piece->strftime(...), as the > following patch.
Oops. s/strftime/strptime/g; Show quoted text
> > --- a/lib/Image/ExifTool/Writer.pl > +++ b/lib/Image/ExifTool/Writer.pl > @@ -4334,7 +4334,7 @@ sub InverseDateTime($$;$$) > if ($hasStrptime == 1) { > @a = POSIX::strptime($val, $fmt); > } else { > - @a = Time::Piece::_strptime($val, $fmt); > + @a = Time::Piece->strptime($val, $fmt); > } > if (defined $a[5] and length $a[5]) { > $a[5] += 1900; # add 1900 to year > > > Cheers
Subject: Re: [rt.cpan.org #123472] Not enough arguments for Time::Piece::_strptime error
Date: Wed, 1 Nov 2017 07:05:34 -0400
To: bug-Image-ExifTool [...] rt.cpan.org
From: Phil Harvey <phil [...] owl.phy.queensu.ca>
Great, thanks! This patch will appear in ExifTool 10.66 - Phil Show quoted text
> On Nov 1, 2017, at 12:52 AM, Kenichi Ishigaki via RT <bug-Image-ExifTool@rt.cpan.org> wrote: > > - @a = Time::Piece::_strptime($val, $fmt); > + @a = Time::Piece->strptime($val, $fmt);
Subject: Re: [rt.cpan.org #123472] Not enough arguments for Time::Piece::_strptime error
Date: Wed, 1 Nov 2017 08:09:58 -0400
To: bug-Image-ExifTool [...] rt.cpan.org
From: Phil Harvey <phil [...] owl.phy.queensu.ca>
Turns out your patch didn't work. I needed to do this instead: + Time::Piece->use_locale() if $Time::Piece::VERSION ge '1.32'; + my $t = Time::Piece->strptime($val, $fmt); + @a = ($t->sec, $t->min, $t->hour, $t->mday, $t->_mon, $t->_year); Because Time::Piece->strptime() returns a Time::Piece object. - Phil P.S. My original code works up to Time::Piece version 1.29_03 Show quoted text
> On Nov 1, 2017, at 7:05 AM, Phil Harvey <phil@owl.phy.queensu.ca> wrote: > > Great, thanks! This patch will appear in ExifTool 10.66 > > - Phil >
>> On Nov 1, 2017, at 12:52 AM, Kenichi Ishigaki via RT <bug-Image-ExifTool@rt.cpan.org> wrote: >> >> - @a = Time::Piece::_strptime($val, $fmt); >> + @a = Time::Piece->strptime($val, $fmt);
> >
On Wed Nov 01 21:12:22 2017, phil@owl.phy.queensu.ca wrote: Show quoted text
> Turns out your patch didn't work. I needed to do this instead: > > + Time::Piece->use_locale() if $Time::Piece::VERSION > ge '1.32'; > + my $t = Time::Piece->strptime($val, $fmt); > + @a = ($t->sec, $t->min, $t->hour, $t->mday, $t-
> >_mon, $t->_year);
> > Because Time::Piece->strptime() returns a Time::Piece object. > > - Phil > > P.S. My original code works up to Time::Piece version 1.29_03 >
> > On Nov 1, 2017, at 7:05 AM, Phil Harvey <phil@owl.phy.queensu.ca> > > wrote: > > > > Great, thanks! This patch will appear in ExifTool 10.66 > > > > - Phil > >
> >> On Nov 1, 2017, at 12:52 AM, Kenichi Ishigaki via RT <bug-Image- > >> ExifTool@rt.cpan.org> wrote: > >> > >> - @a = Time::Piece::_strptime($val, $fmt); > >> + @a = Time::Piece->strptime($val, $fmt);
> > > >
Sorry for my buggy patch. Thanks for the update!
RT-Send-CC: phil [...] owl.phy.queensu.ca
Hi. Could you release a patched version to CPAN so that we can install it by a CPAN client?
Right, sorry. It was patched in 10.66 and I haven't yet released a production version. I plan to do so within a couple of weeks. - Phil
On Fri Feb 02 02:11:57 2018, EXIFTOOL wrote: Show quoted text
> Right, sorry. It was patched in 10.66 and I haven't yet released a > production version. I plan to do so within a couple of weeks. > > - Phil
Thank you for the release!