Hi
I have a method in my base class called "now" which effectively calls
call DateTime->now(time_zone => 'local'). In most cases, it works as
expected. However, in one subclass it errors out. I can't seem to
reduce the problem to a simple test case, but have identified that the
problem occurs in DateTime::TimeZone::Local::Unix:
eval
{
File::Find::find
( { wanted =>
sub
{
if ( ! defined $real_name
&& -f $_
&& ! -l $_
&& $size == -s _
# This fixes RT 24026 - apparently such a
# file exists on FreeBSD and it can cause a
# false positive
&& File::Basename::basename($_) ne
'posixrules'
&& File::Compare::compare( $_,
$file_to_match ) == 0
)
{
$real_name = $_;
# File::Find has no mechanism for bailing in
the
# middle of a find.
die { found => 1 };
}
},
no_chdir => 1,
},
'/usr/share/zoneinfo',
);
};
if ($@)
{
return $real_name if ref $@ && $...@->{found};
die $@;
}
The "die { found => 1 };" instruction sets $@ tp "HASH(0xac2a148) at /
usr/local/lib/perl5/site_perl/5.10.0/DateTime/TimeZone/Local/Unix.pm
line 115" and hence there is never a $...@->{found}.
Why it works for some calls and not this particular instance, I'll
never know. After bashing my head trying to solve the problem for a
couple of days, I have a simple workaround which is undoubtedly more
efficient anyway, but which doesn't solve the underlying problem:
our $TZ = DateTime::TimeZone->new( name => 'local' );
sub now {
my $self = shift;
return DateTime->now(time_zone => $TZ);
}
Happy to log a bug, but I can't provide a minimal test case
Regards Dan