diff options
Diffstat (limited to 'lib/ManaTools/Shared/Action.pm')
-rw-r--r-- | lib/ManaTools/Shared/Action.pm | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/ManaTools/Shared/Action.pm b/lib/ManaTools/Shared/Action.pm index 34e968cf..1c211296 100644 --- a/lib/ManaTools/Shared/Action.pm +++ b/lib/ManaTools/Shared/Action.pm @@ -65,6 +65,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. use Moose; +use Moose::Util::TypeConstraints; +use MooseX::ClassAttribute; + has 'name' => ( is => 'ro', isa => 'Str', @@ -107,5 +110,43 @@ has 'valid' => ( } ); +subtype 'LevelType' + => as Int + => where {($_ > 0 && $_ <= 3)}; + +has 'level' => ( + traits => ['Code'], + is => 'ro', + isa => 'CodeRef', + required => 0, + default => sub { + return sub { return 1; }; + }, + handles => { + is_level => 'execute' + } +); + +class_has 'beginnerLevel' => ( + is => 'ro', + isa => 'LevelType', + init_arg => undef, + default => sub {return 1;}, +); + +class_has 'advancedLevel' => ( + is => 'ro', + isa => 'LevelType', + init_arg => undef, + default => sub {return 2;}, +); + +class_has 'expertLevel' => ( + is => 'ro', + isa => 'LevelType', + init_arg => undef, + default => sub {return 3;}, +); + 1; |