[Catalyst] Problem to use set_sql CDBI

Omid Houshyar omid at ozino.com
Sat Jan 28 16:33:51 CET 2006


I have problem to get the result of set_sql like the one below:

package panel::Model::CDBI::SvpnUsers;

use strict;

__PACKAGE__->set_sql( allUsersCounts => qq{
                     SELECT count(*) as cnt
                     FROM   svpn_users
package panel::Controller::user;

use strict;
use warnings;
use base 'Catalyst::Controller';

sub allUsersCounts : Local {
    my ( $self, $c ) = @_;
    my @usersCounts = ();
    my $svpnUsers = "panel::Model::CDBI::SvpnUsers";
    @usersCounts = $svpnUsers->search_allUsersCounts();
    foreach (@usersCounts) {
#    return @usersCounts;
The SQL works correctly and I don't see any problem here but i've got 
this error:

|Caught exception in panel::Controller::user->allUsersCounts "Can't locate object method "cnt" via package "panel::Model::CDBI::SvpnUsers" at /files/Project/SecureVPN/SecureVPN/newWebsite/panel/script/../lib/panel/Controller/user.pm line 39."

Any recommendation to get access to these type of SQL ... (Don't reply if it's really stopid question ;-))|

Omid Houshyar

More information about the Catalyst mailing list