From: Yuval Kogman Date: Sat, 28 Jun 2008 19:10:22 +0000 (+0000) Subject: remove my cargoculted abuse of ref() (it never returns undef) X-Git-Tag: 0_55~73 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=267f8179e340201137fb8c257855fc56d2bd39e6;p=gitmo%2FMoose.git remove my cargoculted abuse of ref() (it never returns undef) --- diff --git a/lib/Moose/Meta/Method/Constructor.pm b/lib/Moose/Meta/Method/Constructor.pm index 13362e0..5473151 100644 --- a/lib/Moose/Meta/Method/Constructor.pm +++ b/lib/Moose/Meta/Method/Constructor.pm @@ -128,7 +128,6 @@ sub _generate_BUILDARGS { if ( $args eq '@_' and ( !$buildargs or $buildargs->body == \&Moose::Object::BUILDARGS ) ) { return join("\n", 'do {', - 'no warnings "uninitialized";', 'confess "Single parameters to new() must be a HASH ref"', ' if scalar @_ == 1 && defined $_[0] && ref($_[0]) ne q{HASH};', '(scalar @_ == 1) ? {%{$_[0]}} : {@_};', diff --git a/lib/Moose/Object.pm b/lib/Moose/Object.pm index d59139c..2c52c1d 100644 --- a/lib/Moose/Object.pm +++ b/lib/Moose/Object.pm @@ -25,7 +25,6 @@ sub BUILDARGS { if (scalar @_ == 1) { if (defined $_[0]) { - no warnings 'uninitialized'; (ref($_[0]) eq 'HASH') || confess "Single parameters to new() must be a HASH ref"; return {%{$_[0]}}; diff --git a/lib/Moose/Util/TypeConstraints/OptimizedConstraints.pm b/lib/Moose/Util/TypeConstraints/OptimizedConstraints.pm index fb10012..d3fcac5 100644 --- a/lib/Moose/Util/TypeConstraints/OptimizedConstraints.pm +++ b/lib/Moose/Util/TypeConstraints/OptimizedConstraints.pm @@ -18,15 +18,12 @@ sub Num { !ref($_[0]) && looks_like_number($_[0]) } sub Int { defined($_[0]) && !ref($_[0]) && $_[0] =~ /^-?[0-9]+$/ } -{ - no warnings 'uninitialized'; - sub ScalarRef { ref($_[0]) eq 'SCALAR' } - sub ArrayRef { ref($_[0]) eq 'ARRAY' } - sub HashRef { ref($_[0]) eq 'HASH' } - sub CodeRef { ref($_[0]) eq 'CODE' } - sub RegexpRef { ref($_[0]) eq 'Regexp' } - sub GlobRef { ref($_[0]) eq 'GLOB' } -} +sub ScalarRef { ref($_[0]) eq 'SCALAR' } +sub ArrayRef { ref($_[0]) eq 'ARRAY' } +sub HashRef { ref($_[0]) eq 'HASH' } +sub CodeRef { ref($_[0]) eq 'CODE' } +sub RegexpRef { ref($_[0]) eq 'Regexp' } +sub GlobRef { ref($_[0]) eq 'GLOB' } sub FileHandle { ref($_[0]) eq 'GLOB' && Scalar::Util::openhandle($_[0]) or blessed($_[0]) && $_[0]->isa("IO::Handle") }