From 921b86c57141fcd56a9c07faa0581e50f29e1dfa Mon Sep 17 00:00:00 2001 From: doy Date: Sun, 25 Jan 2009 19:18:09 -0500 Subject: add a warning to catch setting needs_init on attributes that aren't commands --- lib/Bot/Games/Meta/Role/Attribute.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/Bot/Games/Meta/Role/Attribute.pm b/lib/Bot/Games/Meta/Role/Attribute.pm index e9d4d2d..65d11f5 100644 --- a/lib/Bot/Games/Meta/Role/Attribute.pm +++ b/lib/Bot/Games/Meta/Role/Attribute.pm @@ -14,6 +14,13 @@ has needs_init => ( default => 1, ); +before _process_options => sub { + my $self = shift; + my ($name, $options) = @_; + warn "needs_init is useless for attributes without command" + if exists($options->{needs_init}) && !$options->{command}; +}; + around accessor_metaclass => sub { my $orig = shift; my $self = shift; -- cgit v1.2.3-54-g00ecf