X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=blobdiff_plain;f=lib%2FMouse%2FUtil.pm;h=785f07c577bf1e5a589db3bb71576c06853c5cef;hp=4596b2c4339189de5bcfbd3b5b92ff40ec729dbd;hb=02bf7ed13ae5d43392767a38fe71e9606f1dba76;hpb=5482cd4c778e280ce03efcb10a98ce36020e5b56 diff --git a/lib/Mouse/Util.pm b/lib/Mouse/Util.pm index 4596b2c..785f07c 100644 --- a/lib/Mouse/Util.pm +++ b/lib/Mouse/Util.pm @@ -38,7 +38,7 @@ 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_09'; + our $VERSION = '0.48'; my $xs = !(exists $INC{'Mouse/PurePerl.pm'} || $ENV{MOUSE_PUREPERL}); @@ -54,7 +54,7 @@ BEGIN{ Mouse::Util->import({ into => 'Mouse::Meta::Method::Destructor::XS' }, ':meta'); Mouse::Util->import({ into => 'Mouse::Meta::Method::Accessor::XS' }, ':meta'); return 1; - }; + } || 0; #warn $@ if $@; } @@ -65,7 +65,6 @@ BEGIN{ *MOUSE_XS = sub(){ $xs }; } - use Carp (); use Scalar::Util (); @@ -82,9 +81,14 @@ BEGIN { *get_all_metaclass_names = \&Mouse::Meta::Module::_get_all_metaclass_names; # is-a predicates - generate_isa_predicate_for('Mouse::Meta::TypeConstraint' => 'is_a_type_constraint'); - generate_isa_predicate_for('Mouse::Meta::Class' => 'is_a_metaclass'); - generate_isa_predicate_for('Mouse::Meta::Role' => 'is_a_metarole'); + #generate_isa_predicate_for('Mouse::Meta::TypeConstraint' => 'is_a_type_constraint'); + #generate_isa_predicate_for('Mouse::Meta::Class' => 'is_a_metaclass'); + #generate_isa_predicate_for('Mouse::Meta::Role' => 'is_a_metarole'); + + # duck type predicates + generate_can_predicate_for(['_compiled_type_constraint'] => 'is_a_type_constraint'); + generate_can_predicate_for(['create_anon_class'] => 'is_a_metaclass'); + generate_can_predicate_for(['create_anon_role'] => 'is_a_metarole'); } our $in_global_destruction = 0; @@ -141,14 +145,15 @@ BEGIN { # See also MRO::Compat::__get_linear_isa. $get_linear_isa = sub ($;$){ my($classname, $type) = @_; + package # hide from PAUSE + Class::C3; 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); + ? [calculateMRO($classname)] + : $_get_linear_isa_dfs->($classname); }; } @@ -260,7 +265,6 @@ sub load_class { sub is_class_loaded; - sub apply_all_roles { my $applicant = Scalar::Util::blessed($_[0]) ? shift # instance @@ -306,7 +310,6 @@ sub english_list { return join q{, }, @items, "and $tail"; } - # common utilities sub not_supported{ @@ -339,7 +342,6 @@ sub does :method; *does = \&does_role; # alias 1; - __END__ =head1 NAME @@ -348,7 +350,7 @@ Mouse::Util - Features, with or without their dependencies =head1 VERSION -This document describes Mouse version 0.40_09 +This document describes Mouse version 0.48 =head1 IMPLEMENTATIONS FOR