From f68aea5c71c2c2a4c23f0f2b98eff3b582c1a688 Mon Sep 17 00:00:00 2001 From: Angelo Naselli Date: Sun, 30 Aug 2015 11:29:12 +0200 Subject: Added Type constraint on dialog type --- lib/ManaTools/Shared/GUI/Dialog.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/ManaTools/Shared/GUI') diff --git a/lib/ManaTools/Shared/GUI/Dialog.pm b/lib/ManaTools/Shared/GUI/Dialog.pm index 7e91eef8..45fc151f 100644 --- a/lib/ManaTools/Shared/GUI/Dialog.pm +++ b/lib/ManaTools/Shared/GUI/Dialog.pm @@ -74,6 +74,7 @@ use diagnostics; use utf8; with 'ManaTools::Shared::GUI::EventHandlerRole'; +use Moose::Util::TypeConstraints; use yui; use ManaTools::Shared::GUI::Event; @@ -142,9 +143,13 @@ has 'dialog' => ( our $mainDialog = 1; our $popupDialog = 2; +subtype 'DialogType' + => as Int + => where {($_ > 0 && $_<=2)}; + has 'dialogType' => ( is => 'ro', - isa => 'Int', + isa => 'DialogType', required => 1, ); -- cgit v1.2.1