Skip Menu |

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

Report information
The Basics
Id: 120391
Status: open
Priority: 0/
Queue: Template-Plugin-DateTime-Format

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

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



CC: DROLSKY [...] cpan.org
Subject: t/01-live.t fails (with recent DateTime::Format::Strptime?)
On some of my smokers I see the following new error: ... Failed to render: undef error - got 1 extra parameter at t/01-live.t line 19, <DATA> line 1. # Looks like your test exited with 2 just after 3. t/01-live.t .............. Dubious, test returned 2 (wstat 512, 0x200) Failed 1/4 subtests ... I guess this happens with recent versions of DateTime::Format::Strptime, maybe because of this change: https://metacpan.org/changes/distribution/DateTime-Format-Strptime#L22
Confirmed. The problem is that Template::Plugin::DateTime::Format::format tries to pass extra arguments to the format_datetime method. Given the way the code is written, I suspect the intention was to accept an arrayref at 'new' time, and pass its contents to ->format_datetime The attached patch fixes makes it do that. After the patch is applied, tests pass with latest versions of all dependencies.
Subject: Template-Plugin-DateTime-Format.patch
diff --git i/lib/Template/Plugin/DateTime/Format.pm w/lib/Template/Plugin/DateTime/Format.pm index 241ccca..cc0cd64 100644 --- i/lib/Template/Plugin/DateTime/Format.pm +++ w/lib/Template/Plugin/DateTime/Format.pm @@ -15,14 +15,14 @@ sub new { Class::Load::load_class($formatter_class || die 'need class name'); my @new_args = ref $new_args eq 'ARRAY' ? @$new_args : $new_args; - { no warnings; + if ($format_args) { $format_args = [ $format_args ] unless ref $format_args eq 'ARRAY'; } bless { _CONTEXT => $context, formatter => $formatter_class->new(@new_args), - format_args => $format_args, + format_args => $format_args || [], }, $class; } @@ -30,7 +30,7 @@ sub format { my ($self, $date) = @_; my $fmt = $self->{formatter}; - my @args = $self->{format_args}; + my @args = @{$self->{format_args}}; return $fmt->format_datetime($date, @args); }
+1 The above patch fixes this issue for me as well. Would love to see a fixed version on CPAN -- Regards, Michael Schout
I've submitted a PR for this: https://github.com/neilb/Template-Plugin-DateTime-Format/pull/1 -- Regards, Michael Schout