kdjantzen has asked for the wisdom of the Perl Monks concerning the following question:
in a Moose::Role I defined two subtypes
Withsubtype 'OptInt' => as 'Int'; subtype 'OptStr' => as 'Str';
I want to specify an attribute of a classuse Types::Standard qw(Maybe Str Int OptInt OptStr);
which, understandably, results in the error messagehas 'xxx' => (is => 'rw', isa => (Maybe[OptInt])->plus_coercions(OptInt, sub{ + undef }));
How should I specify my subtypes in order to make the above work?Could not find sub 'OptInt' to export in package 'Types::Standard' at
Thanks for any help.
K.D.J.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Moose subtypes
by 1nickt (Canon) on Oct 06, 2016 at 19:23 UTC | |
by kdjantzen (Acolyte) on Oct 09, 2016 at 19:21 UTC |