X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=blobdiff_plain;f=lib%2FMouse%2FUtil.pm;h=c941263e165d534cfe60e6d6fce8bf01162bf169;hp=187aa340e5ee2f1a6010fc1b9aacbad93d1389a4;hb=c35735177e2a2737f046c811218fc6d406a6f22d;hpb=74690b263c1c34456bca81201ccdf30259d22a45 diff --git a/lib/Mouse/Util.pm b/lib/Mouse/Util.pm index 187aa34..c941263 100644 --- a/lib/Mouse/Util.pm +++ b/lib/Mouse/Util.pm @@ -3,6 +3,18 @@ use Mouse::Exporter; # enables strict and warnings sub get_linear_isa($;$); # must be here +sub install_subroutines { # must be here + my $into = shift; + + while(my($name, $code) = splice @_, 0, 2){ + no strict 'refs'; + no warnings 'once', 'redefine'; + use warnings FATAL => 'uninitialized'; + *{$into . '::' . $name} = \&{$code}; + } + return; +} + BEGIN{ # This is used in Mouse::PurePerl Mouse::Exporter->setup_import_methods( @@ -48,6 +60,7 @@ BEGIN{ (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 require XSLoader; XSLoader::load('Mouse', $VERSION); Mouse::Util->import({ into => 'Mouse::Meta::Method::Constructor::XS' }, ':meta'); @@ -68,8 +81,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