Revision history for Perl extension Class::C3.
+0.08 - Wed, Dec 28, 2005
+ - adjusted &_remove_method_dispatch_table to be more
+ discriminating about what it deletes. Thanks to
+ Matt S. Trout for this fix.
+ - tweaked &_merge to avoid un-needed looping. Thanks to
+ Audrey Tang for this fix.
+ - added better support for calling next::method within
+ an eval BLOCK. Thanks to Justin Guenther for this patch
+ and test.
+
0.07 - Wed, Nov 23, 2005
* all bugs found by, and fixes provided by Matt S. Trout *
- fixed issue caused when module is imported more than once
use Scalar::Util 'blessed';
-our $VERSION = '0.07';
+our $VERSION = '0.08';
# this is our global stash of both
# MRO's and method dispatch tables
no strict 'refs';
delete ${"${class}::"}{"()"} if $MRO{$class}->{has_overload_fallback};
foreach my $method (keys %{$MRO{$class}->{methods}}) {
- delete ${"${class}::"}{$method};
+ delete ${"${class}::"}{$method}
+ if \&{"${class}::${method}"} eq
+ $MRO{$class}->{methods}->{$method}->{code};
}
}
# jump out as soon as we find one matching
# there is no reason not too. However, if
# we find one, then just remove the '&& last'
- $nothead++ && last if exists $in_tail{$cand};
+ ++$nothead && last if exists $in_tail{$cand};
}
last unless $nothead; # leave the loop with our canidate ...
$reject = $cand;
use Scalar::Util 'blessed';
-our $VERSION = '0.04';
+our $VERSION = '0.05';
our %METHOD_CACHE;
sub method {
- my @label = (split '::', (caller(1))[3]);
+ my $level = 1;
+ my $method_caller;
+ while ($method_caller = (caller($level++))[3]) {
+ last unless $method_caller eq '(eval)';
+ }
+ my @label = (split '::', $method_caller);
my $label = pop @label;
my $caller = join '::' => @label;
my $self = $_[0];
=head1 CODE COVERAGE
-I use B<Devel::Cover> to test the code coverage of my tests, below is the B<Devel::Cover> report on this module's test suite.
+I use B<Devel::Cover> to test the code coverage of my tests, below is the B<Devel::Cover> report on this
+module's test suite.
---------------------------- ------ ------ ------ ------ ------ ------ ------
File stmt bran cond sub pod time total
---------------------------- ------ ------ ------ ------ ------ ------ ------
- Class/C3.pm 99.2 93.3 66.7 96.0 100.0 92.8 96.3
+ Class/C3.pm 98.6 88.6 75.0 96.0 100.0 70.4 95.2
---------------------------- ------ ------ ------ ------ ------ ------ ------
- Total 99.2 93.3 66.7 96.0 100.0 92.8 96.3
+ Total 98.6 88.6 75.0 96.0 100.0 70.4 95.2
---------------------------- ------ ------ ------ ------ ------ ------ ------
=head1 SEE ALSO
--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 2;
+
+BEGIN {
+ use lib 'opt', '../opt', '..';
+ use_ok('c3');
+}
+
+=pod
+
+This tests the use of an eval{} block to wrap a next::method call.
+
+=cut
+
+{
+ package A;
+ use c3;
+
+ sub foo {
+ die 'A::foo died';
+ return 'A::foo succeeded';
+ }
+}
+
+{
+ package B;
+ use base 'A';
+ use c3;
+
+ sub foo {
+ eval {
+ return 'B::foo => ' . (shift)->next::method();
+ };
+
+ if ($@) {
+ return $@;
+ }
+ }
+}
+
+like(B->foo,
+ qr/^A::foo died/,
+ 'method resolved inside eval{}');
+
+