Hello all,
  I'm the developer of a FOSS kiosk management system, Libki. I'm in the
early stages of a complete rewrite using Catalyst for the web-based
administration interface. This is my first time using Catalyst, but I'm very
excited by the possibilities! I'm having a very strange issue with my
resultsets. For example, I have three tables, a users table, a clients
table, and a sessions table that connects the user to a client.

I grab my users from the database, with any session/client data if the user
is currently logged in to a client kiosk. I am prefetching the session and
client table data.

my $user_rs = $c->model('DB::User')->search( {}, { prefetch => { session =>
'client' } } );

Now I want to loop through it.

    my $row = 0;
    my @row_data;

    while ( my $user = $user_rs->next() ) {
        my $user_id = $user->id;

        warn $user->session->client->clientname;

        my $single_row = {
            cell => [
                $user->id,
                $user->username,
                $user->minutes,
                $user->status,
                $user->is_troublemaker,
                $user->session->client->clientname;
            ]
        };
        push( @row_data, $single_row );
    }


Now, if I try to access any of the other tables, I get an error:
[error] Caught exception in LibkiServer::Controller::Admin::REST->users
"Can't call method "client" on an undefined value at
/home/libki/LibkiServer/script/../lib/LibkiServer/Controller/Admin/REST.pm
line 40."

I don't know why I get this error, but the really crazy part is *the warn
still works*:
Client Name: testclient1 at
/home/libki/LibkiServer/script/../lib/LibkiServer/Controller/Admin/REST.pm
line 40.

If anyone can help me out, I'd be eternally grateful.

Thanks,
Kyle

http://www.kylehall.info
Mill Run Technology Solutions ( http://millruntech.com )
Crawford County Federated Library System ( http://www.ccfls.org )
Meadville Public Library ( http://www.meadvillelibrary.org )
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to