[Catalyst] using Type::Tiny constraint objects as Args() parameters
John Napiorkowski
jjn1056 at yahoo.com
Thu Jul 28 18:00:11 GMT 2022
Try removing use namespace::autoclean;
On Thursday, May 12, 2022, 04:01:49 PM CDT, Nathan Gray <kolibrie at cpan.org> wrote:
I found a fascinating feature documented at https://metacpan.org/pod/Catalyst::Controller#Args
and https://metacpan.org/dist/Catalyst-Runtime/view/lib/Catalyst/RouteMatching.pod#Type-Constraints-in-Args-and-Capture-Args
where you can provide a Type::Tiny or other constraint object to
Args() or CaptureArgs() instead of specifying the number of
arguments to capture as an integer.
However, when I tried it out, I found that even though the
documentation and the Catalyst code (in Catalyst::Action
resolve_type_constraint()) make it clear that a type object is
expected, what is actually received is a string.
Looking deeper, it appears that https://metacpan.org/pod/MooseX::MethodAttributes
is used to retrieve the parameters provided to Args(), and its
documentation shows that only a string will be passed through.
More information about the Catalyst
mailing list