[Catalyst] Problem and solution with Catalyst::Plugin::Authorization::Roles

Jamie Honan jhonan at exemail.com.au
Fri Sep 1 23:46:41 CEST 2006


I had a problem with Catalyst::Plugin::Authorization::Roles.

I'm not using the latest svn, but my version contains this:

sub check_user_roles {
    my $c = shift;
    local $@;
    eval { $c->assert_user_roles(@_) };
}

The role checking worked on my dapper box, but not on windows.
The windows machine used ActiveState and ppm.

The called code was doing this kind of thing:

        my $have = Set::Object->new( $user->roles() );
        my $need = Set::Object->new(@_);

        if ( $have->superset($need) ) {

The various Windows ppm versions of Set::Object were 1.14 or 1.08. 
Set::Object only supports a scalar in new from version 1.15 on.

So:

1. For a single user role, the code in the version I had was returning
a scalar, not an array.

2. The windows Set::Object was 1.14, which threw an exception.

3. The eval in check_user_roles was masking the Set::Object exception.

Hope this helps somebody
Jamie



More information about the Catalyst mailing list