Subject: | coerce doesn't create type constraints on type names |
Simple:
perl -Moose -E'coerce "ArrayRef[Int]", from "Int", via { [$_] }'
Cannot find type 'ArrayRef[Int]', perhaps you forgot to load it at
/usr/local/lib/perl/5.10.1/Moose/Util/TypeConstraints.pm line 581
This is fixed with find_or_parse_type_constraint:
perl -Moose -
E'Moose::Util::TypeConstraints::find_or_parse_type_constraint("ArrayRef[I
nt]");coerce "ArrayRef[Int]", from "Int", via { [$_] }'