in reply to Re^5: Can't call method "find" on an undefined value
in thread Can't call method "find" on an undefined value

$id is irrelevant. As I say, it is the call to model that is failing, not the call to find. find is not being called because it can't be called if model returns undef.

Replies are listed 'Best First'.
Re^7: Can't call method "find" on an undefined value
by Anonymous Monk on Jan 17, 2012 at 15:41 UTC
    in what circumstances  c->model would return  undef. when the DB and schema exist? Schema
    package AddressBook::Schema::AddressDB::Result::Address; # Created by DBIx::Class::Schema::Loader # DO NOT MODIFY THE FIRST PART OF THIS FILE use strict; use warnings; use base 'DBIx::Class::Core'; __PACKAGE__->load_components("InflateColumn::DateTime"); =head1 NAME AddressBook::Schema::AddressDB::Result::Address =cut __PACKAGE__->table("addresses"); =head1 ACCESSORS =head2 id data_type: 'integer' is_nullable: 0 =head2 person data_type: 'integer' is_nullable: 0 =head2 location data_type: 'varchar' is_nullable: 1 size: 20 =head2 postal data_type: 'text' is_nullable: 1 =head2 phone data_type: 'varchar' is_nullable: 1 size: 20 =head2 email data_type: 'varchar' is_nullable: 1 size: 100 =cut __PACKAGE__->add_columns( "id", { data_type => "integer", is_nullable => 0 }, "person", { data_type => "integer", is_nullable => 0 }, "location", { data_type => "varchar", is_nullable => 1, size => 20 }, "postal", { data_type => "text", is_nullable => 1 }, "phone", { data_type => "varchar", is_nullable => 1, size => 20 }, "email", { data_type => "varchar", is_nullable => 1, size => 100 }, ); __PACKAGE__->set_primary_key("id"); __PACKAGE__->belongs_to( person => 'AddressBook::Schema::AddressDB::Result::People'); # Created by DBIx::Class::Schema::Loader v0.07002 @ 2012-01-04 14:50:1 +5 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:LXbQtPHwvP3E1JP8yppNhQ # You can replace this text with custom content, and it will be preser +ved on regeneration 1;

      No idea. On the few occasions I've used Catalyst, I never had much need for Catalyst::Model. But that's what the error message is saying.

      Can't call method "find" on an undefined value

      ... means that you're effectively trying to do this:

      undef->find($id)

      So the only thing that could be happening is that the model method is returning undef.

      If you don't believe me, run the following Perl one-liner at the command line...

      perl -e'undef->find(1)'

      And verify that you get the exact same error message.

        you're right. perl -e'undef->find(1)' Can't call method "find" on an undefined value at -e line 1. i am learning catalyst and perl can you point me to book and/or sites where i could have more info.