Question

i setup the Catalyst::Plugin::Authorization::Abilities module from this link:

[http://search.cpan.org/dist/Catalyst-Plugin-Authorization-Abilities/lib/Catalyst/Plugin/Authorization/Abilities.pm][1]

Bur when call this function:

$c->assert_user_ability('show_home_action');

I got this message prob:

Caught exception in OpConsole::Controller::Root->index "Can't use string ("Catalyst::Authentication::Store:"...) as a HASH ref while "strict refs" in use at accessor Catalyst::Authentication::Store::DBIx::Class::User::_user (defined at /root/perl5/lib/perl5/Catalyst/Authentication/Store/DBIx/Class/User.pm line 12) line 5."

i check few times my configuration and it seem to me that's all ok. but what's the prob :/

Was it helpful?

Solution 2

I found the prob, it was a wrong configuration in the database (in UserAction table i had wrong field name ("actio_id" => "action_id")). so every thx is ok now :p

OTHER TIPS

Usually this error message means you've used something that was meant to be an object method as if it were a class method.

use v5.14;

package Foo {
   use Moose;
   has foo => (is => 'ro', default => 42);
}

my $class  = 'Foo';
my $object = $class->new;

say $object->foo;  # 42
say $class->foo;   # Can't use string ("Foo") as a HASH ref...

This is because the foo method (which is generated by Moose in the above example) is implemented something like this:

sub foo {
   my $self = shift;
   return $self->{foo};
}

So it treats the first parameter ($self) as a hash ref. If the method is called like $class->foo, then $class which is a string, is treated like a hash ref, which is disallowed by strict "refs".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top