Skip Menu |

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

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

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

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



Subject: Can't call method "close" on an undefined value
When I end my script, I get: Can't call method "close" on an undefined value at Log/Report.pm line 228. Line 228 contains: END { $_->close for values %{$reporter->{dispatchers}} } Any idea why this happens? This happens in version 0.27
Subject: Re: [rt.cpan.org #57955] Can't call method "close" on an undefined value
Date: Fri, 28 May 2010 20:27:40 +0200
To: Jan Henning Thorsen via RT <bug-Log-Report [...] rt.cpan.org>
From: Mark Overmeer <solutions [...] overmeer.net>
* Jan Henning Thorsen via RT (bug-Log-Report@rt.cpan.org) [100528 18:11]: Show quoted text
> Fri May 28 14:11:52 2010: Request 57955 was acted upon. > Transaction: Ticket created by JHTHORSEN > Queue: Log-Report > Subject: Can't call method "close" on an undefined value > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: JHTHORSEN@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=57955 > > > > When I end my script, I get: > Can't call method "close" on an undefined value at Log/Report.pm line > 228. > > Line 228 contains: > END { $_->close for values %{$reporter->{dispatchers}} } > > Any idea why this happens? > This happens in version 0.27
Can you show me an extract from your script which reproduces this error? I use this module everywhere without this problem. -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
Subject: Re: [rt.cpan.org #57955] Can't call method "close" on an undefined value
Date: Fri, 28 May 2010 20:36:24 +0200
To: bug-Log-Report [...] rt.cpan.org
From: Jan Henning Thorsen <jhthorsen [...] cpan.org>
It's in an END {} block, so there must be something wrong with the initializing of reporters I think. I'm using some custom Log::Report::Dispatcher -- could that be it? Anyway. Something is clearly figuring out that the values/a value in $reporter->{dispatchers} is undef too late. On Fri, May 28, 2010 at 8:27 PM, Mark Overmeer via RT <bug-Log-Report@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=57955 > > > * Jan Henning Thorsen via RT (bug-Log-Report@rt.cpan.org) [100528 18:11]:
>> Fri May 28 14:11:52 2010: Request 57955 was acted upon. >> Transaction: Ticket created by JHTHORSEN >>        Queue: Log-Report >>      Subject: Can't call method "close" on an undefined value >>    Broken in: (no value) >>     Severity: (no value) >>        Owner: Nobody >>   Requestors: JHTHORSEN@cpan.org >>       Status: new >>  Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=57955 > >> >> >> When I end my script, I get: >>  Can't call method "close" on an undefined value at Log/Report.pm line >> 228. >> >> Line 228 contains: >>  END { $_->close for values %{$reporter->{dispatchers}} } >> >> Any idea why this happens? >> This happens in version 0.27
> > Can you show me an extract from your script which reproduces this > error?  I use this module everywhere without this problem. > -- > Regards, >               MarkOv > > ------------------------------------------------------------------------ >       Mark Overmeer MSc                                MARKOV Solutions >       Mark@Overmeer.net                          solutions@overmeer.net > http://Mark.Overmeer.net                   http://solutions.overmeer.net > > >
Subject: Re: [rt.cpan.org #57955] Can't call method "close" on an undefined value
Date: Fri, 28 May 2010 21:21:33 +0200
To: bug-Log-Report [...] rt.cpan.org
From: Jan Henning Thorsen <jhthorsen [...] cpan.org>
I think auto vivification bites: Inside sub dispatcher($@) you got: { my ($type, $name) = (shift, shift); my $disp = Log::Report::Dispatcher->new($type, $name , mode => $default_mode, @_); # old dispatcher with same name will be closed in DESTROY $reporter->{dispatchers}{$name} = $disp; _whats_needed; return ($disp); } But you don't check if $reporter->{dispatchers}{$name} exists, nor if $disp is _anything_ ... can that be a clue? On Fri, May 28, 2010 at 8:36 PM, Jan Henning Thorsen <jhthorsen@cpan.org> wrote: Show quoted text
> It's in an END {} block, so there must be something wrong with the > initializing of reporters I think. I'm using some custom > Log::Report::Dispatcher -- could that be it? Anyway. Something is > clearly figuring out that the values/a value in > $reporter->{dispatchers} is undef too late. > > On Fri, May 28, 2010 at 8:27 PM, Mark Overmeer via RT > <bug-Log-Report@rt.cpan.org> wrote:
>> <URL: https://rt.cpan.org/Ticket/Display.html?id=57955 > >> >> * Jan Henning Thorsen via RT (bug-Log-Report@rt.cpan.org) [100528 18:11]:
>>> Fri May 28 14:11:52 2010: Request 57955 was acted upon. >>> Transaction: Ticket created by JHTHORSEN >>>        Queue: Log-Report >>>      Subject: Can't call method "close" on an undefined value >>>    Broken in: (no value) >>>     Severity: (no value) >>>        Owner: Nobody >>>   Requestors: JHTHORSEN@cpan.org >>>       Status: new >>>  Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=57955 > >>> >>> >>> When I end my script, I get: >>>  Can't call method "close" on an undefined value at Log/Report.pm line >>> 228. >>> >>> Line 228 contains: >>>  END { $_->close for values %{$reporter->{dispatchers}} } >>> >>> Any idea why this happens? >>> This happens in version 0.27
>> >> Can you show me an extract from your script which reproduces this >> error?  I use this module everywhere without this problem. >> -- >> Regards, >>               MarkOv >> >> ------------------------------------------------------------------------ >>       Mark Overmeer MSc                                MARKOV Solutions >>       Mark@Overmeer.net                          solutions@overmeer.net >> http://Mark.Overmeer.net                   http://solutions.overmeer.net >> >> >>
>
Subject: Re: [rt.cpan.org #57955] Can't call method "close" on an undefined value
Date: Fri, 28 May 2010 21:40:23 +0200
To: Jan Henning Thorsen via RT <bug-Log-Report [...] rt.cpan.org>
From: Mark Overmeer <solutions [...] overmeer.net>
* Jan Henning Thorsen via RT (bug-Log-Report@rt.cpan.org) [100528 18:36]: Show quoted text
> Queue: Log-Report > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=57955 > > > It's in an END {} block, so there must be something wrong with the > initializing of reporters I think. I'm using some custom > Log::Report::Dispatcher -- could that be it? Anyway. Something is > clearly figuring out that the values/a value in > $reporter->{dispatchers} is undef too late.
What kind of "custom dispatcher" did you need (I thought I had all options covered). Can you share it? I do not anticipate on dispatchers which fail to initialize without throwing an exception. You're right about that. Although I would not advice that, I may happen, so I will change this: sub dispatcher($@) { if($_[0] !~ m/^(?:close|find|list|disable|enable|mode|needs|filter)$/) { my ($type, $name) = (shift, shift); my $disp = Log::Report::Dispatcher->new($type, $name - , mode => $default_mode, @_); + , mode => $default_mode, @_) + or return; # old dispatcher with same name will be closed in DESTROY $reporter->{dispatchers}{$name} = $disp; _whats_needed; return ($disp); } -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
Subject: Re: [rt.cpan.org #57955] Can't call method "close" on an undefined value
Date: Fri, 28 May 2010 21:41:20 +0200
To: Jan Henning Thorsen via RT <bug-Log-Report [...] rt.cpan.org>
From: Mark Overmeer <solutions [...] overmeer.net>
* Jan Henning Thorsen via RT (bug-Log-Report@rt.cpan.org) [100528 19:22]: Show quoted text
> Queue: Log-Report > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=57955 > > > I think auto vivification bites: Inside sub dispatcher($@) you got: > > { my ($type, $name) = (shift, shift); > my $disp = Log::Report::Dispatcher->new($type, $name > , mode => $default_mode, @_); > > # old dispatcher with same name will be closed in DESTROY > $reporter->{dispatchers}{$name} = $disp; > _whats_needed; > return ($disp);
There is no autovivification in this code. -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
Subject: Re: [rt.cpan.org #57955] Can't call method "close" on an undefined value
Date: Fri, 28 May 2010 23:23:38 +0200
To: bug-Log-Report [...] rt.cpan.org
From: Jan Henning Thorsen <jhthorsen [...] cpan.org>
Sorry. "autovivification" wasn't the right word... Anyway. Looking forward to the next version. For now, the fix for my is simply to close the right logger :) On Fri, May 28, 2010 at 9:41 PM, Mark Overmeer via RT <bug-Log-Report@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=57955 > > > * Jan Henning Thorsen via RT (bug-Log-Report@rt.cpan.org) [100528 19:22]:
>>        Queue: Log-Report >>  Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=57955 > >> >> I think auto vivification bites: Inside sub dispatcher($@) you got: >> >>     {   my ($type, $name) = (shift, shift); >>         my $disp = Log::Report::Dispatcher->new($type, $name >>           , mode => $default_mode, @_); >> >>         # old dispatcher with same name will be closed in DESTROY >>         $reporter->{dispatchers}{$name} = $disp; >>         _whats_needed; >>         return ($disp);
> > There is no autovivification in this code. > -- > Regards, >               MarkOv > > ------------------------------------------------------------------------ >       Mark Overmeer MSc                                MARKOV Solutions >       Mark@Overmeer.net                          solutions@overmeer.net > http://Mark.Overmeer.net                   http://solutions.overmeer.net > > >
Still wondering why you need your own dispatcher implementation... anyway, it will not crash anymore.