From: Brandon L Black Date: Wed, 23 Aug 2006 14:57:22 +0000 (+0000) Subject: use Alg::C3 0.05 persistent merge cache parameter, VERSION/Changes for 0.13 X-Git-Tag: 0.13~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FClass-C3.git;a=commitdiff_plain;h=f4a893b2743451ba7414466464e0e8d843458cfa;hp=f480cda1e94bd73d3773e442a8767e73c544e140 use Alg::C3 0.05 persistent merge cache parameter, VERSION/Changes for 0.13 --- diff --git a/ChangeLog b/ChangeLog index 44bc706..206f57b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ Revision history for Perl extension Class::C3. +0.13 Not Yet Released XXXX + - Make use of Algorithm::C3 0.05's merge caching + 0.12 Tues. July 18, 2006 - clarifying docs for &initialize (thanks jcs) - applying patch from Robert Norris to add @@ -91,4 +94,4 @@ Revision history for Perl extension Class::C3. 0.01 - Sun, Aug 7, 2005 - initial release of module - - some code and tests based on previous Perl6::MetaModel work \ No newline at end of file + - some code and tests based on previous Perl6::MetaModel work diff --git a/Makefile.PL b/Makefile.PL index d4c4e9a..a074d35 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -6,6 +6,6 @@ WriteMakefile( 'Test::More' => 0.47, 'Test::Exception' => 0.15, 'Scalar::Util' => 1.10, - 'Algorithm::C3' => 0.01, + 'Algorithm::C3' => 0.05, } ); diff --git a/lib/Class/C3.pm b/lib/Class/C3.pm index 1b67490..73e8228 100644 --- a/lib/Class/C3.pm +++ b/lib/Class/C3.pm @@ -7,7 +7,7 @@ use warnings; use Scalar::Util 'blessed'; use Algorithm::C3; -our $VERSION = '0.12'; +our $VERSION = '0.13'; # this is our global stash of both # MRO's and method dispatch tables @@ -67,15 +67,16 @@ sub reinitialize { ## functions for applying C3 to classes sub _calculate_method_dispatch_tables { + my %merge_cache; foreach my $class (keys %MRO) { - _calculate_method_dispatch_table($class); + _calculate_method_dispatch_table($class, \%merge_cache); } } sub _calculate_method_dispatch_table { - my $class = shift; + my ($class, $merge_cache) = @_; no strict 'refs'; - my @MRO = calculateMRO($class); + my @MRO = calculateMRO($class, $merge_cache); $MRO{$class} = { MRO => \@MRO }; my $has_overload_fallback = 0; my %methods; @@ -139,11 +140,11 @@ sub _remove_method_dispatch_table { ## functions for calculating C3 MRO sub calculateMRO { - my ($class) = @_; + my ($class, $merge_cache) = @_; return Algorithm::C3::merge($class, sub { no strict 'refs'; @{$_[0] . '::ISA'}; - }); + }, $merge_cache); } package # hide me from PAUSE @@ -570,4 +571,4 @@ L This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. -=cut \ No newline at end of file +=cut