X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=blobdiff_plain;f=lib%2FMouse%2FUtil.pm;h=c76d3b54ab9b42b3fc59530358e49e523da6bcf5;hp=783f24a169c7d18541c9058defdafbc9b1b69f66;hb=506fb74dbff3e8f756230c643d8bff7b85ae9ca3;hpb=923a04ba4adf1b79269e749b6bafba309be6335a diff --git a/lib/Mouse/Util.pm b/lib/Mouse/Util.pm index 783f24a..c76d3b5 100644 --- a/lib/Mouse/Util.pm +++ b/lib/Mouse/Util.pm @@ -38,13 +38,11 @@ BEGIN{ # Because Mouse::Util is loaded first in all the Mouse sub-modules, # XS loader is placed here, not in Mouse.pm. - our $VERSION = '0.40_08'; + our $VERSION = '0.40_09'; my $xs = !(exists $INC{'Mouse/PurePerl.pm'} || $ENV{MOUSE_PUREPERL}); if($xs){ - local $@; - # XXX: XSLoader tries to get the object path from caller's file name # $hack_mouse_file fools its mechanism @@ -54,6 +52,7 @@ BEGIN{ XSLoader::load('Mouse', $VERSION); Mouse::Util->import({ into => 'Mouse::Meta::Method::Constructor::XS' }, ':meta'); Mouse::Util->import({ into => 'Mouse::Meta::Method::Destructor::XS' }, ':meta'); + Mouse::Util->import({ into => 'Mouse::Meta::Method::Accessor::XS' }, ':meta'); return 1; }; #warn $@ if $@; @@ -114,36 +113,43 @@ BEGIN { require mro; $get_linear_isa = \&mro::get_linear_isa; } else { - my $e = do { - local $@; - eval { require MRO::Compat }; - $@; - }; - if (!$e) { - $get_linear_isa = \&mro::get_linear_isa; - } else { # VVVVV CODE TAKEN FROM MRO::COMPAT VVVVV - my $_get_linear_isa_dfs; # this recurses so it isn't pretty - $_get_linear_isa_dfs = sub ($;$){ - no strict 'refs'; - - my $classname = shift; - - my @lin = ($classname); - my %stored; - foreach my $parent (@{"$classname\::ISA"}) { - my $plin = $_get_linear_isa_dfs->($parent); - foreach my $p(@$plin) { - next if exists $stored{$p}; - push(@lin, $p); - $stored{$p} = 1; - } + my $_get_linear_isa_dfs; # this recurses so it isn't pretty + $_get_linear_isa_dfs = sub { + my($classname) = @_; + + my @lin = ($classname); + my %stored; + + no strict 'refs'; + foreach my $parent (@{"$classname\::ISA"}) { + my $plin = $_get_linear_isa_dfs->($parent); + foreach my $p(@$plin) { + next if exists $stored{$p}; + push(@lin, $p); + $stored{$p} = 1; } - return \@lin; - }; + } + return \@lin; + }; # ^^^^^ CODE TAKEN FROM MRO::COMPAT ^^^^^ - $get_linear_isa = $_get_linear_isa_dfs; - } + + eval{ require Class::C3 }; + + # MRO::Compat::__get_linear_isa has no prototype, so + # we define a prototyped version for compatibility with core's + # See also MRO::Compat::__get_linear_isa. + $get_linear_isa = sub ($;$){ + my($classname, $type) = @_; + if(!defined $type){ + package Class::C3; + our %MRO; + $type = exists $MRO{$classname} ? 'c3' : 'dfs'; + } + return $type eq 'c3' + ? [Class::C3::calculateMRO($classname)] + : $_get_linear_isa_dfs->($classname); + }; } *get_linear_isa = $get_linear_isa; @@ -342,7 +348,7 @@ Mouse::Util - Features, with or without their dependencies =head1 VERSION -This document describes Mouse version 0.40_08 +This document describes Mouse version 0.40_09 =head1 IMPLEMENTATIONS FOR