From: Shawn M Moore Date: Sun, 28 Sep 2008 04:29:20 +0000 (+0000) Subject: Alter the weaken support a bit X-Git-Tag: 0.19~205 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=commitdiff_plain;h=577be3900a87552be0c16d354f2302ef7030cc2c;hp=465af41f1c0dd7add92fca6f4e40a320e6c7d4ec Alter the weaken support a bit --- diff --git a/lib/Mouse/Util.pm b/lib/Mouse/Util.pm index aeaaf3f..625ed4e 100644 --- a/lib/Mouse/Util.pm +++ b/lib/Mouse/Util.pm @@ -6,6 +6,8 @@ use base 'Exporter'; our %dependencies = ( 'Scalar::Util' => { + +# VVVVV CODE TAKEN FROM SCALAR::UTIL VVVVV 'blessed' => do { do { no strict 'refs'; @@ -86,8 +88,14 @@ our %dependencies = ( (tied(*$fh) or defined(fileno($fh))) ? $fh : undef; }, + weaken => { + loaded => \&Scalar::Util::weaken, + not_loaded => sub { die "Scalar::Util required for weak reference support" }, + }, +# ^^^^^ CODE TAKEN FROM SCALAR::UTIL ^^^^^ }, 'MRO::Compat' => { +# VVVVV CODE TAKEN FROM MRO::COMPAT VVVVV 'get_linear_isa' => { loaded => \&mro::get_linear_isa, not_loaded => do { @@ -112,6 +120,7 @@ our %dependencies = ( } }, }, +# ^^^^^ CODE TAKEN FROM MRO::COMPAT ^^^^^ }, ); @@ -145,11 +154,6 @@ for my $module_name (keys %dependencies) { } } -push @EXPORT_OK, qw(weaken); -sub weaken { - require Scalar::Util; - goto \&Scalar::Util::weaken; -} 1;