X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMouse.pm;h=708b0a55fea49e377ddd885f1bd40cea5e741896;hb=eae8075956ba01581ea7488b4ddb2506db1111da;hp=b8e8f97f53cce48943615f87d5592cffde6dd609;hpb=11ac534bdfe4aab1f8bfb575769dee68f456c1d9;p=gitmo%2FMouse.git diff --git a/lib/Mouse.pm b/lib/Mouse.pm index b8e8f97..708b0a5 100644 --- a/lib/Mouse.pm +++ b/lib/Mouse.pm @@ -1,31 +1,35 @@ -#!/usr/bin/env perl + package Mouse; use strict; use warnings; +use 5.006; use base 'Exporter'; -our $VERSION = '0.12'; -use 5.006; +our $VERSION; +our $PurePerl; -if ($ENV{SHIKA_DEBUG}) { - *DEBUG = sub (){ 1 }; -} else { - *DEBUG = sub (){ 0 }; -} +BEGIN { + $VERSION = '0.12'; -our $PurePerl; -$PurePerl = $ENV{SHIKA_PUREPERL} unless defined $PurePerl; + if ($ENV{MOUSE_DEBUG}) { + *DEBUG = sub (){ 1 }; + } else { + *DEBUG = sub (){ 0 }; + } + if (! defined $PurePerl && $ENV{MOUSE_PUREPERL} && $ENV{MOUSE_PUREPERL} =~ /^(.+)$/) { + $PurePerl = $1; + } -if (! $PurePerl) { - local $@; - local $^W = 0; - require XSLoader; - $PurePerl = !eval{ XSLoader::load(__PACKAGE__, $VERSION); 1 }; - warn "Failed to load XS mode: $@" if $@ && Mouse::DEBUG(); + 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'; @@ -110,7 +114,7 @@ sub import { no warnings 'redefine'; *{$caller.'::meta'} = sub { $meta }; - Mouse->export_to_level(1, @_); + __PACKAGE__->export_to_level( 1, @_); } sub unimport {