Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Log-Dispatch CPAN distribution.

Report information
The Basics
Id: 49944
Status: resolved
Priority: 0/
Queue: Log-Dispatch

People
Owner: Nobody in particular
Requestors: cwh [...] webeve.de
Cc:
AdminCc:

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



Subject: Log::Dispatch::File constructor doesn't cope with new API
Using Log::Dispatch::File with the new API leads to this error: "Reference found where even-sized list expected at /usr/lib/perl5/vendor_perl/5.10.0/Log/Dispatch/File.pm line 26." My code looks like this: my $log = Log::Dispatch->new( outputs => [ ['File', { min_level => 'debug', filename => '/tmp/file.log', mode => 'append', stderr => 0, autoflush => 1, newline => 1 } ] ] ); The attached patch fixes that.
Subject: File.pm.diff
--- lib/Log/Dispatch/File.pm 2009-09-16 00:57:51.000000000 +0200 +++ File.pm 2009-09-22 17:57:51.000000000 +0200 @@ -23,7 +23,7 @@ my $proto = shift; my $class = ref $proto || $proto; - my %p = @_; + my %p = validate(@_, {}); my $self = bless {}, $class;
On Wed Sep 23 09:15:46 2009, http://cwh.clavid.com/ wrote: Show quoted text
> Using Log::Dispatch::File with the new API leads to this error: > "Reference found where even-sized list expected at > /usr/lib/perl5/vendor_perl/5.10.0/Log/Dispatch/File.pm line 26." > > My code looks like this: > my $log = Log::Dispatch->new( outputs => [ ['File', > { min_level => 'debug', > filename => '/tmp/file.log', > mode => 'append', > stderr => 0, > autoflush => 1, > newline => 1 } ] ] ); > > The attached patch fixes that.
I think you've misread the docs. The supported form is: ( outputs => [ [ File => min_level => 'debug', ... ] ] ) There was another "short" constructor briefly documented for 2.23, but it wasn't the one you have above. I'm going to close this ticket. Please don't respond directly, or this ticket will be re-opened.