Skip Menu |

This queue is for tickets about the Class-Std CPAN distribution.

Report information
The Basics
Id: 13962
Status: resolved
Priority: 0/
Queue: Class-Std

People
Owner: Nobody in particular
Requestors: dan.kubb-cpan [...] autopilotmarketing.com
Cc:
AdminCc:

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



Subject: Bug in Class::Std CUMULATIVE handling
There is a bug in how Class::Std handles CUMULATIVE method calls. The output of previous executions of a method (and it's ancestors) is not reset upon completion of the operation. Attached is a failing test case patch. The simplest way I could demonstrate the bug was simply to repeat the tests in t/cumulative.t a second time. I'll append a second entry to this bug with a patch to fix the problem within the lib.
--- t/cumulative.t~ 2005-05-14 18:05:45.000000000 -0700 +++ t/cumulative.t 2005-08-01 12:06:32.000000000 -0700 @@ -54,7 +54,7 @@ package main; -use Test::More 'no_plan'; +use Test::More tests => 60; my $obj = Reder1->new(); @@ -64,24 +64,26 @@ my $up_string = join q{}, @up_order; my $down_string = join q{}, @down_order; -my $res_up = $obj->der_first(); -my $res_down = $obj->base_first(); - -is int $res_up, int @up_order => 'Numeric cumulative up'; -is int $res_down, int @down_order => 'Numeric cumulative down'; - -is "$res_up", $up_string => 'String cumulative up'; -is "$res_down", $down_string => 'String cumulative down'; - -is_deeply \@$res_up, \@up_order => 'List cumulative up'; -is_deeply \@$res_down, \@down_order => 'List cumulative down'; - -for my $classname (keys %$res_up) { - ok grep($classname, @up_order) => "Valid up hash key ($classname)"; - is $classname, $res_up->{$classname} => "Valid up hash value ($classname)"; -} - -for my $classname (keys %$res_down) { - ok grep($classname, @down_order) => "Valid down hash key ($classname)"; - is $classname, $res_up->{$classname} => "Valid down hash value ($classname)"; +for my $test_run (1..2) { + my $res_up = $obj->der_first(); + my $res_down = $obj->base_first(); + + is int $res_up, int @up_order => 'Numeric cumulative up'; + is int $res_down, int @down_order => 'Numeric cumulative down'; + + is "$res_up", $up_string => 'String cumulative up'; + is "$res_down", $down_string => 'String cumulative down'; + + is_deeply \@$res_up, \@up_order => 'List cumulative up'; + is_deeply \@$res_down, \@down_order => 'List cumulative down'; + + for my $classname (keys %$res_up) { + ok grep($classname, @up_order) => "Valid up hash key ($classname)"; + is $classname, $res_up->{$classname} => "Valid up hash value ($classname)"; + } + + for my $classname (keys %$res_down) { + ok grep($classname, @down_order) => "Valid down hash key ($classname)"; + is $classname, $res_up->{$classname} => "Valid down hash value ($classname)"; + } }
From: Dan Kubb <dan.kubb [...] autopilotmarketing.com>
Subject: Re: [cpan #13962]
Date: Mon, 1 Aug 2005 12:29:02 -0700
To: bug-Class-Std [...] rt.cpan.org
RT-Send-Cc:
Inside Class::Std there was a location where you pushed onto @results, but you had pre-declared my @result (singular) just earlier. I fixed this issue and also added use strict to make sure there were no other similar bugs within the code. no strict 'refs' was added where appropriate, and I tried to affect the smallest scope possible each time. Attached is a patch that resolves the failing test cases.

Message body is not shown because sender requested not to inline it.

Date: Mon, 01 Aug 2005 16:48:26 -0700
From: Damian Conway <damian [...] conway.org>
To: bug-Class-Std [...] rt.cpan.org
Subject: Re: [cpan #13962] Bug in Class::Std CUMULATIVE handling
RT-Send-Cc:
Awesome work, Dan. Thank-you so much for the clear, report, the excellent patches and the many improvements to the module implementation. Top stuff! All patches applied and tested. New upload imminent. Damian