From: Shawn M Moore Date: Tue, 17 Jun 2008 03:38:52 +0000 (+0000) Subject: Make has_attribute actually work X-Git-Tag: 0.19~302 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=83d0a1f4f1f73b914e26c1fb52626331de318c68;p=gitmo%2FMouse.git Make has_attribute actually work --- diff --git a/lib/Mouse/Meta/Role.pm b/lib/Mouse/Meta/Role.pm index 927945a..92b39c1 100644 --- a/lib/Mouse/Meta/Role.pm +++ b/lib/Mouse/Meta/Role.pm @@ -32,11 +32,8 @@ sub new { sub name { $_[0]->{name} } -sub has_attribute { } - -sub add_attribute { - $_[0]->{attributes}->{$_[1]} = $_[2]; -} +sub has_attribute { exists $_[0]->{attributes}->{$_[1]} } +sub add_attribute { $_[0]->{attributes}->{$_[1]} = $_[2] } 1; diff --git a/t/401-meta-role.t b/t/401-meta-role.t index 8816a8c..85a6dc2 100644 --- a/t/401-meta-role.t +++ b/t/401-meta-role.t @@ -1,7 +1,7 @@ #!/usr/bin/env perl use strict; use warnings; -use Test::More tests => 3; +use Test::More tests => 5; do { package Role;