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)";
+ }
}