[Catalyst] Action attributes

Илья forihrd at gmail.com
Sat Jun 6 03:35:53 GMT 2009


Hi there,
we use Catalyst about year and one thing make a lot of pain. When you
make typo in action attribute name Catalyst silently eat it. For
example:

sub foo : Loacal Arg(1) {

}

will be work, but Arg(1) just do nothing.

Now we use few additional attributes and I add trivial check in
Our::Catalyst::Action:

    my @correct_names = qw<
        Path
        Private
        Global
        Local
        Regex
        LocalRexgex
        Args
        Chained
        CaptureArgs
        PathPart

        Method
        Secure
        UnSecure
        RestrictTo
        Crumb
        Test
       >;

    foreach my $name (keys %$attrs) {
        unless ( first { $name eq $_ } @correct_names ) {
            die "Wrong trait (attribute) $name!";
        }
    }

so it is work for us, but mb better to add something like this in
Catalyst itself? I can make patch if this helps.

Excuse my ugly English, plz.

Ilya



More information about the Catalyst mailing list