From: Stevan Little Date: Thu, 3 Jan 2008 07:25:17 +0000 (+0000) Subject: using a little less overload stuff X-Git-Tag: 0_35~35 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b644e331bf70b87de226f1e228257d5ea1f4043c;p=gitmo%2FMoose.git using a little less overload stuff --- diff --git a/lib/Moose/Meta/Class.pm b/lib/Moose/Meta/Class.pm index 0416b2e..2e1759b 100644 --- a/lib/Moose/Meta/Class.pm +++ b/lib/Moose/Meta/Class.pm @@ -185,7 +185,7 @@ sub add_override_method_modifier { my @args = @_; no warnings 'redefine'; if ($Moose::SUPER_SLOT{$_super_package}) { - local *{$Moose::SUPER_SLOT{$_super_package}} = sub { $super->(@args) }; + local *{$Moose::SUPER_SLOT{$_super_package}} = sub { $super->body->(@args) }; return $method->(@args); } else { confess "Trying to call override modifier'd method without super()"; @@ -219,10 +219,10 @@ sub add_augment_method_modifier { local *{$Moose::INNER_SLOT{$_super_package}} = sub {}; $method->(@args); }; - return $super->(@args); + return $super->body->(@args); } else { - return $super->(@args); + return $super->body->(@args); } }); } diff --git a/lib/Moose/Meta/TypeConstraint.pm b/lib/Moose/Meta/TypeConstraint.pm index 02bb03d..691337c 100644 --- a/lib/Moose/Meta/TypeConstraint.pm +++ b/lib/Moose/Meta/TypeConstraint.pm @@ -5,8 +5,8 @@ use strict; use warnings; use metaclass; -#use overload '""' => sub { shift->name }, # stringify to tc name -# fallback => 1; +use overload '""' => sub { shift->name }, # stringify to tc name + fallback => 1; use Sub::Name 'subname'; use Carp 'confess'; diff --git a/t/040_type_constraints/001_util_type_constraints.t b/t/040_type_constraints/001_util_type_constraints.t index 72cfc3c..353a344 100644 --- a/t/040_type_constraints/001_util_type_constraints.t +++ b/t/040_type_constraints/001_util_type_constraints.t @@ -32,7 +32,7 @@ ok(Number(5), '... this is a Num'); ok(!defined(Number('Foo')), '... this is not a Num'); { my $number_tc = Moose::Util::TypeConstraints::find_type_constraint('Number'); - is($number_tc->name, 'Number', '... type constraint stringifies to name'); + is("$number_tc", 'Number', '... type constraint stringifies to name'); } ok(String('Foo'), '... this is a Str');