summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordoy <doy@tozt.net>2009-01-25 19:18:09 -0500
committerdoy <doy@tozt.net>2009-01-25 19:18:09 -0500
commit921b86c57141fcd56a9c07faa0581e50f29e1dfa (patch)
treec3d21bd90310f215b69e754cdb6c66dbcf39ebdf
parent5f89d5ee8ab7e25d773c6d2dfe1ac38b96fd5be5 (diff)
downloadbot-games-921b86c57141fcd56a9c07faa0581e50f29e1dfa.tar.gz
bot-games-921b86c57141fcd56a9c07faa0581e50f29e1dfa.zip
add a warning to catch setting needs_init on attributes that aren't commands
-rw-r--r--lib/Bot/Games/Meta/Role/Attribute.pm7
1 files changed, 7 insertions, 0 deletions
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;