X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMouse%2FUtil.pm;h=949b65433cf06d71e175f5496c4d1003c3320465;hb=34bdc46af065df1aa23fefd987f02e7e1856e87e;hp=a2593cf2e4d758872a43f50452d322b3f55636d5;hpb=b06ce1f502945c13a52c503f1a651fe92c91c773;p=gitmo%2FMouse.git diff --git a/lib/Mouse/Util.pm b/lib/Mouse/Util.pm index a2593cf..949b654 100644 --- a/lib/Mouse/Util.pm +++ b/lib/Mouse/Util.pm @@ -11,11 +11,17 @@ BEGIN{ if(!$need_pp && !exists $INC{'Mouse/PurePerl.pm'}){ local $@; - $need_pp = !eval{ + + # 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 + print "$hack_mouse_file\n"; + $need_pp = !eval sprintf("#line %d %s\n", __LINE__, $hack_mouse_file) . q{ require XSLoader; XSLoader::load('Mouse', $VERSION); }; - warn $@ if $@; # for DEBUGGING + #warn $@ if $@; } if($need_pp){ @@ -252,8 +258,7 @@ sub apply_all_roles { my $role_name = $roles[-1][0]; load_class($role_name); - my $metarole = get_metaclass_by_name($role_name); - ( $metarole && $metarole->isa('Mouse::Meta::Role') ) + Mouse::Util::TypeConstraints::_is_a_metarole( get_metaclass_by_name($role_name) ) || $applicant->meta->throw_error("You can only consume roles, $role_name(".$role_name->meta.") is not a Mouse role"); }