Skip Menu |
 

This queue is for tickets about the Catalyst-Runtime CPAN distribution.

Report information
The Basics
Id: 104451
Status: open
Priority: 0/
Queue: Catalyst-Runtime

People
Owner: Nobody in particular
Requestors: autumn [...] autumnlansing.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in:
  • 5.90090
  • 5.90091
Fixed in: (no value)



Subject: Errors using type constraints in Args
Download (untitled) / with headers
text/plain 2.4k
I was looking forward to using type constraints in Args with this new release, but I keep stumbling across the same error message. Following the examples in the Route Matching pod, doing this: sub item : Chained('base') PathPart('item') GET Args('Int') { my ( $self, $c, $item ) = @_; .... } results in this error message: 'Int' not a type constraint in /item at /home/autumn/perl5/lib/perl5/Catalyst/Action.pm line 246. Trying the same method using Types::Standard without quoting the type, as per the documentation, produces the same error. Trying it with multiple type constraints, as per the docs, also turns up a similar error message: 'Int,Int,Str' not a type constraint in /item at /home/autumn/perl5/lib/perl5/Catalyst/Action.pm line 246. I tried this in two of my Catalyst projects, both with the same result. Thinking the problem might have something to do with other parts of my code, I created a brand-new Catalyst project for testing, using the helper script, and copy-pasted two examples from the docs into the Root controller: sub find :Path('') Args('Int') { my ($self, $c, $int) = @_; } and use Types::Standard qw/Int Str/; sub find :Path('') Args(Int,Int,Str) { my ($self, $c, $int1, $int2, $str) = @_; } I still get the same error messages with both. This happens with Args and CaptureArgs. I'm far from being a Perl guru, so looking at line 246 of Catalyst::Action, in the resolve_type_constraint method, I'm not sure what's going on there enough to know where the problem lies. my @tc = eval "package ${\$self->class}; $name" or die "'$name' not a type constraint in ${\$self->private_path}"; I've never seen eval used with "package" and can't find any explanation of what it does with a Google search (and only a few examples using grep.cpan.me), so I may be reading this wrong. It seems to be testing whether both the referring package exists and that $name isn't empty? The die message though seems to indicate that it's testing whether $name is a valid type constraint, but I don't see it actually doing that. $name obviously exists, as it's being returned in the error message, so I'm assuming the package statement is causing the issue? Also, since using multiple constraint arguments results in 'Int,Int,Str' as $name, the die message appears to be even more confusing, as 'Int,Int,Str' would certainly never be a valid type constraint. I'm using Perl 5.20.1 on Linux kernel 3.16.7, openSUSE 13.2 x86_64.
From: juan.paredes [...] gmail.com
Download (untitled) / with headers
text/plain 579b
El Jue May 14 17:38:36 2015, autumn@autumnlansing.com escribió: Show quoted text
> > sub item : Chained('base') PathPart('item') GET Args('Int') { > my ( $self, $c, $item ) = @_; > .... > } > > results in this error message: > > 'Int' not a type constraint in /item at > /home/autumn/perl5/lib/perl5/Catalyst/Action.pm line 246. > > Trying the same method using Types::Standard without quoting the type, > as per the documentation, produces the same error.
Make sure you aren't using namespace::autoclean on your Controller, as it will remove the imported types from Types::Standard
From: sgivan [...] yahoo.com
Download (untitled) / with headers
text/plain 2.3k
I'm seeing this bug in the arg_contraints.t: args [20] do not match the type constraints in action 'user' at t/arg_constraints.t line 509. captures [1 2 3 4 5] do not match the type constraints in actionchain ending with 'finally' at t/arg_constraints.t line 523. args [a] do not match the type constraints in action 'finally' at t/arg_constraints.t line 532. captures [a a 3 4 4] do not match the type constraints in actionchain ending with 'finally' at t/arg_constraints.t line 537. args [1] do not match the type constraints in action 'heart' at t/arg_constraints.t line 545. captures [2] do not match the type constraints in actionchain ending with 'utf8_end' at t/arg_constraints.t line 554. [error] Caught exception in engine "Int is not a constraint! at /usr/home/xxxx/.cpan/build/Catalyst-Runtime-5.90100-rjVccJ/blib/lib/Catalyst/Action.pm line 153." # Failed test at t/arg_constraints.t line 589. # got: 'Bad Request' # expected: 'an_int (withrole)' [error] Caught exception in engine "Int is not a constraint! at /usr/home/xxxx/.cpan/build/Catalyst-Runtime-5.90100-rjVccJ/blib/lib/Catalyst/Action.pm line 153." # Failed test at t/arg_constraints.t line 594. # got: 'Bad Request' # expected: 'from_parent 1' # Looks like you failed 2 tests of 69. I'm using perl 5.12.2 on freeBSD. # Failed test at t/arg_constraints.t line 589. # got: 'Bad Request' # expected: 'an_int (withrole)' [error] Caught exception in engine "Int is not a constraint! at /usr/home/xxxx/.cpan/build/Catalyst-Runtime-5.90100-rjVccJ/blib/lib/Catalyst/Action.pm line 153." # Failed test at t/arg_constraints.t line 594. # got: 'Bad Request' # expected: 'from_parent 1' # Looks like you failed 2 tests of 69. On Thu Jul 09 02:49:05 2015, jparedes wrote: Show quoted text
> El Jue May 14 17:38:36 2015, autumn@autumnlansing.com escribió:
> > > > sub item : Chained('base') PathPart('item') GET Args('Int') { > > my ( $self, $c, $item ) = @_; > > .... > > } > > > > results in this error message: > > > > 'Int' not a type constraint in /item at > > /home/autumn/perl5/lib/perl5/Catalyst/Action.pm line 246. > > > > Trying the same method using Types::Standard without quoting the > > type, > > as per the documentation, produces the same error.
> > Make sure you aren't using namespace::autoclean on your Controller, as > it will remove the imported types from Types::Standard
Download (untitled) / with headers
text/plain 2.6k
On 2015-08-30 08:16:25, https://me.yahoo.com/a/GPQLTshqg8I40rqMZn.WsdSPLg--#3b3c9 wrote: Show quoted text
> I'm seeing this bug in the arg_contraints.t: > > args [20] do not match the type constraints in action 'user' at > t/arg_constraints.t line 509. > captures [1 2 3 4 5] do not match the type constraints in actionchain > ending with 'finally' at t/arg_constraints.t line 523. > args [a] do not match the type constraints in action 'finally' at > t/arg_constraints.t line 532. > captures [a a 3 4 4] do not match the type constraints in actionchain > ending with 'finally' at t/arg_constraints.t line 537. > args [1] do not match the type constraints in action 'heart' at > t/arg_constraints.t line 545. > captures [2] do not match the type constraints in actionchain ending > with 'utf8_end' at t/arg_constraints.t line 554. > [error] Caught exception in engine "Int is not a constraint! at > /usr/home/xxxx/.cpan/build/Catalyst-Runtime-5.90100- > rjVccJ/blib/lib/Catalyst/Action.pm line 153." > > # Failed test at t/arg_constraints.t line 589. > # got: 'Bad Request' > # expected: 'an_int (withrole)' > [error] Caught exception in engine "Int is not a constraint! at > /usr/home/xxxx/.cpan/build/Catalyst-Runtime-5.90100- > rjVccJ/blib/lib/Catalyst/Action.pm line 153." > > # Failed test at t/arg_constraints.t line 594. > # got: 'Bad Request' > # expected: 'from_parent 1' > # Looks like you failed 2 tests of 69. > > > I'm using perl 5.12.2 on freeBSD. > > # Failed test at t/arg_constraints.t line 589. > # got: 'Bad Request' > # expected: 'an_int (withrole)' > [error] Caught exception in engine "Int is not a constraint! at > /usr/home/xxxx/.cpan/build/Catalyst-Runtime-5.90100- > rjVccJ/blib/lib/Catalyst/Action.pm line 153." > > # Failed test at t/arg_constraints.t line 594. > # got: 'Bad Request' > # expected: 'from_parent 1' > # Looks like you failed 2 tests of 69. >
I see the same problem on a linux system (debian/wheezy), perl 5.14.4. Show quoted text
> > On Thu Jul 09 02:49:05 2015, jparedes wrote:
> > El Jue May 14 17:38:36 2015, autumn@autumnlansing.com escribió:
> > > > > > sub item : Chained('base') PathPart('item') GET Args('Int') { > > > my ( $self, $c, $item ) = @_; > > > .... > > > } > > > > > > results in this error message: > > > > > > 'Int' not a type constraint in /item at > > > /home/autumn/perl5/lib/perl5/Catalyst/Action.pm line 246. > > > > > > Trying the same method using Types::Standard without quoting the > > > type, > > > as per the documentation, produces the same error.
> > > > Make sure you aren't using namespace::autoclean on your Controller, > > as > > it will remove the imported types from Types::Standard
Can people verify they still have errors like this? We've done a bunch of updates over the past few months and also updated the route matching pod with more help. Please review and close ticket if its all good On Sun Aug 30 13:23:02 2015, SREZIC wrote: Show quoted text
> On 2015-08-30 08:16:25, > https://me.yahoo.com/a/GPQLTshqg8I40rqMZn.WsdSPLg--#3b3c9 wrote:
> > I'm seeing this bug in the arg_contraints.t: > > > > args [20] do not match the type constraints in action 'user' at > > t/arg_constraints.t line 509. > > captures [1 2 3 4 5] do not match the type constraints in actionchain > > ending with 'finally' at t/arg_constraints.t line 523. > > args [a] do not match the type constraints in action 'finally' at > > t/arg_constraints.t line 532. > > captures [a a 3 4 4] do not match the type constraints in actionchain > > ending with 'finally' at t/arg_constraints.t line 537. > > args [1] do not match the type constraints in action 'heart' at > > t/arg_constraints.t line 545. > > captures [2] do not match the type constraints in actionchain ending > > with 'utf8_end' at t/arg_constraints.t line 554. > > [error] Caught exception in engine "Int is not a constraint! at > > /usr/home/xxxx/.cpan/build/Catalyst-Runtime-5.90100- > > rjVccJ/blib/lib/Catalyst/Action.pm line 153." > > > > # Failed test at t/arg_constraints.t line 589. > > # got: 'Bad Request' > > # expected: 'an_int (withrole)' > > [error] Caught exception in engine "Int is not a constraint! at > > /usr/home/xxxx/.cpan/build/Catalyst-Runtime-5.90100- > > rjVccJ/blib/lib/Catalyst/Action.pm line 153." > > > > # Failed test at t/arg_constraints.t line 594. > > # got: 'Bad Request' > > # expected: 'from_parent 1' > > # Looks like you failed 2 tests of 69. > > > > > > I'm using perl 5.12.2 on freeBSD. > > > > # Failed test at t/arg_constraints.t line 589. > > # got: 'Bad Request' > > # expected: 'an_int (withrole)' > > [error] Caught exception in engine "Int is not a constraint! at > > /usr/home/xxxx/.cpan/build/Catalyst-Runtime-5.90100- > > rjVccJ/blib/lib/Catalyst/Action.pm line 153." > > > > # Failed test at t/arg_constraints.t line 594. > > # got: 'Bad Request' > > # expected: 'from_parent 1' > > # Looks like you failed 2 tests of 69. > >
> > I see the same problem on a linux system (debian/wheezy), perl 5.14.4. >
> > > > On Thu Jul 09 02:49:05 2015, jparedes wrote:
> > > El Jue May 14 17:38:36 2015, autumn@autumnlansing.com escribió:
> > > > > > > > sub item : Chained('base') PathPart('item') GET Args('Int') { > > > > my ( $self, $c, $item ) = @_; > > > > .... > > > > } > > > > > > > > results in this error message: > > > > > > > > 'Int' not a type constraint in /item at > > > > /home/autumn/perl5/lib/perl5/Catalyst/Action.pm line 246. > > > > > > > > Trying the same method using Types::Standard without quoting the > > > > type, > > > > as per the documentation, produces the same error.
> > > > > > Make sure you aren't using namespace::autoclean on your Controller, > > > as > > > it will remove the imported types from Types::Standard


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.