summaryrefslogtreecommitdiffstats
path: root/lib/Bread/Board/Declare/Role/Service.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Bread/Board/Declare/Role/Service.pm')
-rw-r--r--lib/Bread/Board/Declare/Role/Service.pm9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Bread/Board/Declare/Role/Service.pm b/lib/Bread/Board/Declare/Role/Service.pm
index 96bdaf7..1ed4265 100644
--- a/lib/Bread/Board/Declare/Role/Service.pm
+++ b/lib/Bread/Board/Declare/Role/Service.pm
@@ -36,8 +36,13 @@ around get => sub {
}
my $val = $self->$orig(@_);
- $attr->verify_against_type_constraint($val, instance => $container)
- if $attr->has_type_constraint;
+
+ if ($attr->has_type_constraint) {
+ $val = $attr->type_constraint->coerce($val)
+ if $attr->should_coerce;
+
+ $attr->verify_against_type_constraint($val, instance => $container);
+ }
return $val;
};