diff options
author | Jesse Luehrs <doy@tozt.net> | 2009-06-01 02:51:02 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2009-06-01 02:57:29 -0500 |
commit | da928b59285b96179db5cecd1325efe3aff1e93b (patch) | |
tree | b640e2484bc7f11794586b33a8c273cae4ec1585 /lib/Bot/Games/OO | |
parent | 3e11ec4d081928b62027baae9d9ede5ab8c2da2a (diff) | |
download | bot-games-da928b59285b96179db5cecd1325efe3aff1e93b.tar.gz bot-games-da928b59285b96179db5cecd1325efe3aff1e93b.zip |
allow specifying a type constraint name instead of a coderef as a formatter
Diffstat (limited to 'lib/Bot/Games/OO')
-rw-r--r-- | lib/Bot/Games/OO/Game.pm | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Bot/Games/OO/Game.pm b/lib/Bot/Games/OO/Game.pm index 0bc294a..2da71bd 100644 --- a/lib/Bot/Games/OO/Game.pm +++ b/lib/Bot/Games/OO/Game.pm @@ -30,7 +30,12 @@ sub command { $class->meta->add_method($name, $method_meta); } for my $attr (map { $_->meta->get_attribute_list } @method_metaclass_roles) { - $method_meta->$attr($args{$attr}) if exists $args{$attr}; + next unless exists $args{$attr}; + my $value = $args{$attr}; + my $munge_method = "_munge_$attr"; + $value = $method_meta->$munge_method($value) + if $method_meta->can($munge_method); + $method_meta->$attr($value); } } |