projects
/
gitmo/Mouse.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
(parent:
05c74c2
)
Stub 'has_attribute' and make 'has' use 'add_attribute'
Shawn M Moore [Tue, 17 Jun 2008 03:38:45 +0000 (
03:38
+0000)]
lib/Mouse/Meta/Role.pm
patch
|
blob
|
blame
|
history
lib/Mouse/Role.pm
patch
|
blob
|
blame
|
history
diff --git
a/lib/Mouse/Meta/Role.pm
b/lib/Mouse/Meta/Role.pm
index
f04dd18
..
927945a
100644
(file)
--- 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
(file)
--- 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 { }