Skip Menu |

This queue is for tickets about the Time-Piece CPAN distribution.

Report information
The Basics
Id: 19677
Status: resolved
Priority: 0/
Queue: Time-Piece

People
Owner: Nobody in particular
Requestors: william [...] knowmad.com
Cc:
AdminCc:

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



Although all tests are passing for me under Perl 5.8.7 and Ubuntu Linux, I am receiving the following error in v1.09 when trying to use localtime() function: Can't call method "isa" without a package or object reference at /usr/local/lib/perl/5.8.7/Time/Piece.pm line 101. Although the code in 101 is wrapped in an eval, it's still causing my scripts to fail. Here's a patch to evaluate the $class object before trying to call isa(). --- /tmp/Piece.pm 2006-06-03 12:41:59.000000000 -0400 +++ /usr/local/lib/perl/5.8.7/Time/Piece.pm 2006-06-03 12:39:38.000000000 -0400 @@ -98,7 +98,7 @@ sub _mktime { my ($class, $time, $islocal) = @_; - $class = eval { (ref $class)->isa('Time::Piece') } ? ref $class : $class; + $class = eval { (ref $class) && (ref $class)->isa('Time::Piece') } ? ref $class : $class; if (ref($time)) { $time->[c_epoch] = undef; return wantarray ? @$time : bless [@$time, $islocal], $class; Thanks, William
On Sat Jun 03 12:47:40 2006, guest wrote: Show quoted text
> Although all tests are passing for me under Perl 5.8.7 and Ubuntu Linux, > I am receiving the following error in v1.09 when trying to use > localtime() function: > > Can't call method "isa" without a package or object reference at > /usr/local/lib/perl/5.8.7/Time/Piece.pm line 101. > > Although the code in 101 is wrapped in an eval, it's still causing my > scripts to fail. Here's a patch to evaluate the $class object before > trying to call isa(). > > > --- /tmp/Piece.pm 2006-06-03 12:41:59.000000000 -0400 > +++ /usr/local/lib/perl/5.8.7/Time/Piece.pm 2006-06-03 > 12:39:38.000000000 -0400 > @@ -98,7 +98,7 @@ > > sub _mktime { > my ($class, $time, $islocal) = @_; > - $class = eval { (ref $class)->isa('Time::Piece') } ? ref $class : > $class; > + $class = eval { (ref $class) && (ref $class)->isa('Time::Piece') } > ? ref $class : $class; > if (ref($time)) { > $time->[c_epoch] = undef; > return wantarray ? @$time : bless [@$time, $islocal], $class; > > > > Thanks, > William
Applied. Thanks.