From: Shawn M Moore Date: Tue, 17 Jun 2008 03:38:45 +0000 (+0000) Subject: Stub 'has_attribute' and make 'has' use 'add_attribute' X-Git-Tag: 0.19~303 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0fc8adbcddaae0c610e5c1bc1beb067a9c265f69;p=gitmo%2FMouse.git Stub 'has_attribute' and make 'has' use 'add_attribute' --- diff --git a/lib/Mouse/Meta/Role.pm b/lib/Mouse/Meta/Role.pm index f04dd18..927945a 100644 --- a/lib/Mouse/Meta/Role.pm +++ b/lib/Mouse/Meta/Role.pm @@ -32,5 +32,11 @@ sub new { sub name { $_[0]->{name} } +sub has_attribute { } + +sub add_attribute { + $_[0]->{attributes}->{$_[1]} = $_[2]; +} + 1; diff --git a/lib/Mouse/Role.pm b/lib/Mouse/Role.pm index 312f1ad..3b455de 100644 --- a/lib/Mouse/Role.pm +++ b/lib/Mouse/Role.pm @@ -32,7 +32,13 @@ do { return sub { } }, has => sub { - return sub { } + my $caller = $CALLER; + return sub { + my $name = shift; + my @opts = @_; + + $caller->meta->add_attribute($name => \@opts); + } }, with => sub { return sub { }