X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMouse%2FUtil.pm;h=edecfa6e9434e1617bb108b9ba9d23382f6a15be;hb=bdef60b43281bb85a2a4bed85de0069ae3925068;hp=98dd1371284930a161166e83745f25d113f0204c;hpb=d67f600df9deb0deb95616f617c1aca3fd78a2e3;p=gitmo%2FMouse.git diff --git a/lib/Mouse/Util.pm b/lib/Mouse/Util.pm index 98dd137..edecfa6 100644 --- a/lib/Mouse/Util.pm +++ b/lib/Mouse/Util.pm @@ -1,9 +1,11 @@ package Mouse::Util; use Mouse::Exporter; # enables strict and warnings -sub get_linear_isa($;$); # must be here +# must be here because it will be refered by other modules loaded +sub get_linear_isa($;$); ## no critic -sub install_subroutines { # must be here +# must be here because it will called in Mouse::Exporter +sub install_subroutines { my $into = shift; while(my($name, $code) = splice @_, 0, 2){ @@ -46,21 +48,18 @@ BEGIN{ }, ); + our $VERSION = '0.68'; - # Because Mouse::Util is loaded first in all the Mouse sub-modules, - # XS loader is placed here, not in Mouse.pm. - - our $VERSION = '0.50_03'; - - my $xs = !(exists $INC{'Mouse/PurePerl.pm'} || $ENV{MOUSE_PUREPERL}); + my $xs = !(defined(&is_valid_class_name) || $ENV{MOUSE_PUREPERL} || $ENV{PERL_ONLY}); + # Because Mouse::Util is loaded first in all the Mouse sub-modules, + # XSLoader must be placed here, not in Mouse.pm. if($xs){ # XXX: XSLoader tries to get the object path from caller's file name # $hack_mouse_file fools its mechanism - (my $hack_mouse_file = __FILE__) =~ s/.Util//; # .../Mouse/Util.pm -> .../Mouse.pm $xs = eval sprintf("#line %d %s\n", __LINE__, $hack_mouse_file) . q{ - local $^W = 0; # work around 'redefine' warning to &install_subroutines + local $^W = 0; # workaround 'redefine' warning to &install_subroutines require XSLoader; XSLoader::load('Mouse', $VERSION); Mouse::Util->import({ into => 'Mouse::Meta::Method::Constructor::XS' }, ':meta'); @@ -81,8 +80,6 @@ BEGIN{ use Carp (); use Scalar::Util (); -use constant _MOUSE_VERBOSE => !!$ENV{MOUSE_VERBOSE}; - # aliases as public APIs # it must be 'require', not 'use', because Mouse::Meta::Module depends on Mouse::Util require Mouse::Meta::Module; # for the entities of metaclass cache utilities @@ -156,7 +153,7 @@ BEGIN { { package # hide from PAUSE Class::C3; - our %MRO; # work around 'once' warnings + our %MRO; # avoid 'once' warnings } # MRO::Compat::__get_linear_isa has no prototype, so @@ -244,7 +241,6 @@ sub load_first_existing_class { } # taken from Class/MOP.pm -my %is_class_loaded_cache; sub _try_load_one_class { my $class = shift; @@ -253,7 +249,7 @@ sub _try_load_one_class { Carp::confess "Invalid class name ($display)"; } - return undef if $is_class_loaded_cache{$class} ||= is_class_loaded($class); + return '' if is_class_loaded($class); $class =~ s{::}{/}g; $class .= '.pm'; @@ -366,7 +362,7 @@ Mouse::Util - Features, with or without their dependencies =head1 VERSION -This document describes Mouse version 0.50_03 +This document describes Mouse version 0.68 =head1 IMPLEMENTATIONS FOR