| 1 | package Gapp::App::Types; | ||
| 2 | { | ||
| 3 | $Gapp::App::Types::VERSION = '0.007'; | ||
| 4 | } | ||
| 5 | |||
| 6 | use MooseX::Types -declare => [qw( | ||
| 7 | GappAppHookAction | ||
| 8 | )]; | ||
| 9 | |||
| 10 | use MooseX::Types::Moose qw( Str ); | ||
| 11 | |||
| 12 | subtype GappAppHookAction | ||
| 13 | => as Str | ||
| 14 | => where { $_ eq 'aggregate' || $_ eq 'halt' } | ||
| 15 | => message { "hook action must be 'aggregate' or 'halt'" }; | ||
| 16 | |||
| 17 | # accept aggr* for 'aggregate' | ||
| 18 | coerce GappAppHookAction | ||
| 19 | => from Str | ||
| 20 | => via { /^aggr/ ? 'aggregate' : undef }; | ||
| 21 | |||
| 22 | |||
| 23 | 1; |