Skip Menu |

This queue is for tickets about the DateTime-Format-CLDR CPAN distribution.

Report information
The Basics
Id: 49604
Status: resolved
Priority: 0/
Queue: DateTime-Format-CLDR

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

Bug Information
Severity: Critical
Broken in: 1.08
Fixed in: (no value)



Subject: Fatal error with DateTime::Format::CLDR as formatter
~> cat dt.pl use strict; use warnings; use diagnostics; use DateTime; use DateTime::Format::CLDR; use DateTime::Format::Strptime; my $f1 = DateTime::Format::Strptime->new( pattern => '%d.%m.%Y %T', locale => 'de_DE', time_zone => 'Europe/Berlin', ); my $f2 = DateTime::Format::CLDR->new( pattern => 'dd.MM.yyyy HH:mm:ss', locale => 'de_DE', time_zone => 'Europe/Berlin', ); my $dt = DateTime->now; $dt->set_formatter($f1); print "Formatted with DateTime::Format::Strptime: $dt\n"; $dt->set_formatter($f2); print "Formatted with DateTime::Format::CLDR: $dt\n"; ~> perl dt.pl Formatted with DateTime::Format::Strptime: 10.09.2009 20:42:35 Deep recursion on subroutine "DateTime::_stringify" at /usr/lib/perl5/vendor_perl/5.8.8/DateTime/Format/CLDR.pm line 717 (#1) (W recursion) This subroutine has called itself (directly or indirectly) 100 times more than it has returned. This probably indicates an infinite recursion, unless you're writing strange benchmark programs, in which case it indicates something else. Deep recursion on subroutine "DateTime::Format::CLDR::format_datetime" at /usr/lib/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/DateTime.pm line 799 (#1) Segmentation fault DateTime 0.50 DateTime::Format::Strptime 1.1000 DateTime::Format::CLDR 1.08
It is also broken in 1.06, but works fine in 1.02 and 1.01. Tested with Perl 5.8.8 and 5.10.0 on openSUSE.
The problem seems to come from validate_pos() in format_datetime(). If I replace my ( $self, $dt ) = validate_pos( @_, 1, { default => DateTime->now(), type => OBJECT } ); with my ( $self, $dt ) = @_; then everything works fine. Perhaps validate_pos() stringifies $dt as well ... therefore the endless recursion...?
Thank you for your detailed bug report. The issue was fixed in 1.09 On Do. 10. Sep. 2009, 18:19:11, GRAF wrote: Show quoted text
> The problem seems to come from validate_pos() in format_datetime(). > If I replace > my ( $self, $dt ) = validate_pos( @_, 1, { default => DateTime->now(), > type => OBJECT } ); > with > my ( $self, $dt ) = @_; > then everything works fine. > > Perhaps validate_pos() stringifies $dt as well ... therefore the endless > recursion...?