From: Shawn M Moore Date: Sun, 28 Sep 2008 03:43:06 +0000 (+0000) Subject: Mouse::Util::blessed X-Git-Tag: 0.19~214 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8fcbe7fb24ac710b860595ae1ecea066c3add1f5;p=gitmo%2FMouse.git Mouse::Util::blessed --- diff --git a/lib/Mouse/Meta/Attribute.pm b/lib/Mouse/Meta/Attribute.pm index 368e10d..959f712 100644 --- a/lib/Mouse/Meta/Attribute.pm +++ b/lib/Mouse/Meta/Attribute.pm @@ -4,7 +4,8 @@ use strict; use warnings; use Carp 'confess'; -use Scalar::Util qw/blessed weaken/; +use Mouse::Util 'blessed'; +use Scalar::Util 'weaken'; sub new { my $class = shift; diff --git a/lib/Mouse/Meta/Class.pm b/lib/Mouse/Meta/Class.pm index ee7d5dc..73264d1 100644 --- a/lib/Mouse/Meta/Class.pm +++ b/lib/Mouse/Meta/Class.pm @@ -3,8 +3,7 @@ package Mouse::Meta::Class; use strict; use warnings; -use Mouse::Util 'get_linear_isa'; -use Scalar::Util 'blessed'; +use Mouse::Util qw/get_linear_isa blessed/; use Carp 'confess'; use Class::Method::Modifiers (); diff --git a/lib/Mouse/Role.pm b/lib/Mouse/Role.pm index cf47b5b..2f44a75 100644 --- a/lib/Mouse/Role.pm +++ b/lib/Mouse/Role.pm @@ -5,7 +5,7 @@ use warnings; use base 'Exporter'; use Carp 'confess'; -use Scalar::Util 'blessed'; +use Mouse::Util 'blessed'; use Mouse::Meta::Role; diff --git a/lib/Mouse/TypeRegistry.pm b/lib/Mouse/TypeRegistry.pm index 757ed85..a8992c2 100644 --- a/lib/Mouse/TypeRegistry.pm +++ b/lib/Mouse/TypeRegistry.pm @@ -3,7 +3,8 @@ package Mouse::TypeRegistry; use strict; use warnings; -use Scalar::Util qw/looks_like_number blessed openhandle/; +use Mouse::Util 'blessed'; +use Scalar::Util qw/looks_like_number openhandle/; no warnings 'uninitialized'; sub optimized_constraints { diff --git a/lib/Mouse/Util.pm b/lib/Mouse/Util.pm index cc78ccf..c8b3c67 100644 --- a/lib/Mouse/Util.pm +++ b/lib/Mouse/Util.pm @@ -5,6 +5,32 @@ use warnings; use base 'Exporter'; our %dependencies = ( + 'Scalar::Util' => { + 'blessed' => do { + do { + no strict 'refs'; + *UNIVERSAL::a_sub_not_likely_to_be_here = sub { + my $ref = ref($_[0]); + + # deviation from Scalar::Util + # XS returns undef, PP returns GLOB. + # let's make that more consistent by having PP return + # undef if it's a GLOB. :/ + + # \*STDOUT would be allowed as an object in PP blessed + # but not XS + return $ref eq 'GLOB' ? undef : $ref; + }; + }; + + sub { + local($@, $SIG{__DIE__}, $SIG{__WARN__}); + length(ref($_[0])) + ? eval { $_[0]->a_sub_not_likely_to_be_here } + : undef; + }, + }, + }, 'MRO::Compat' => { 'get_linear_isa' => { loaded => \&mro::get_linear_isa,