efc194c98bc5ae90d5f194c69eca245b18fe4337
[gitmo/Moose.git] / lib / Moose / Meta / Method / Accessor / Native / Counter / Writer.pm
1 package Moose::Meta::Method::Accessor::Native::Counter::Writer;
2
3 use strict;
4 use warnings;
5
6 our $AUTHORITY = 'cpan:STEVAN';
7
8 use Moose::Role;
9
10 with 'Moose::Meta::Method::Accessor::Native::Writer';
11
12 sub _constraint_must_be_checked {
13     my $self = shift;
14
15     my $attr = $self->associated_attribute;
16
17     return $attr->has_type_constraint
18         && ($attr->type_constraint->name =~ /^(?:Num|Int)$/
19          || ($attr->should_coerce && $attr->type_constraint->has_coercion)
20            );
21 }
22
23 no Moose::Role;
24
25 1;