X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMouse.pm;h=b8e8f97f53cce48943615f87d5592cffde6dd609;hb=11ac534bdfe4aab1f8bfb575769dee68f456c1d9;hp=380d9b233b59144de787e5eaa490274d6283f55f;hpb=5f46c4bd0be3450c60b7405a5eb84f9bb9c221ac;p=gitmo%2FMouse.git diff --git a/lib/Mouse.pm b/lib/Mouse.pm index 380d9b2..b8e8f97 100644 --- a/lib/Mouse.pm +++ b/lib/Mouse.pm @@ -7,6 +7,25 @@ use base 'Exporter'; our $VERSION = '0.12'; use 5.006; +if ($ENV{SHIKA_DEBUG}) { + *DEBUG = sub (){ 1 }; +} else { + *DEBUG = sub (){ 0 }; +} + +our $PurePerl; +$PurePerl = $ENV{SHIKA_PUREPERL} unless defined $PurePerl; + + +if (! $PurePerl) { + local $@; + local $^W = 0; + require XSLoader; + $PurePerl = !eval{ XSLoader::load(__PACKAGE__, $VERSION); 1 }; + warn "Failed to load XS mode: $@" if $@ && Mouse::DEBUG(); +} + + use Carp 'confess'; use Mouse::Util 'blessed'; @@ -69,11 +88,12 @@ sub with { my $meta = Mouse::Meta::Class->initialize(caller); my $role = shift; + my $args = shift || {}; - confess "Mouse::Role only supports 'with' on individual roles at a time" if @_; + confess "Mouse::Role only supports 'with' on individual roles at a time" if @_ || !ref $args; Mouse::load_class($role); - $role->meta->apply($meta); + $role->meta->apply($meta, %$args); } sub import {