From: gfx Date: Sun, 1 Nov 2009 06:05:04 +0000 (+0900) Subject: Tweaks for Mouse guts, and add Mouse::Util::_MOUSE_XS symbol X-Git-Tag: 0.40_05~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=db5e440949ed1cdf6c788ea7653a488bc8f1b92e;p=gitmo%2FMouse.git Tweaks for Mouse guts, and add Mouse::Util::_MOUSE_XS symbol --- diff --git a/lib/Mouse/Util.pm b/lib/Mouse/Util.pm index 5f3df61..8d4eadb 100644 --- a/lib/Mouse/Util.pm +++ b/lib/Mouse/Util.pm @@ -7,25 +7,27 @@ BEGIN{ our $VERSION = '0.40_04'; - my $need_pp = !!$ENV{MOUSE_PUREPERL}; + my $xs = !(exists $INC{'Mouse/PurePerl.pm'} || $ENV{MOUSE_PUREPERL}); - if(!$need_pp && !exists $INC{'Mouse/PurePerl.pm'}){ + if($xs){ local $@; # 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 - $need_pp = !eval sprintf("#line %d %s\n", __LINE__, $hack_mouse_file) . q{ + $xs = eval sprintf("#line %d %s\n", __LINE__, $hack_mouse_file) . q{ require XSLoader; XSLoader::load('Mouse', $VERSION); }; #warn $@ if $@; } - if($need_pp){ + if(!$xs){ require 'Mouse/PurePerl.pm'; # we don't want to create its namespace } + + *_MOUSE_XS = sub(){ $xs }; }