Calling a method or accessing a member of an undefined object will throw a
fatal error that looks like this:  "can't call method * on an undefined
value at ..."

For example, this code will cause a software error if $data->{itemnumber}
exists, but the item doesn't exist (maybe it's been deleted?):

my $item = Koha::Items->find( $data->{itemnumber} );
my $biblio = $item->biblio;

How this is handled will of course depend on context -- maybe we should
carp and continue, or maybe just

my $item = Koha::Items->find( $data->{itemnumber} );
my $biblio = $item->biblio if defined $item;

I would like to add a coding standard that we always check for this.

Thanks,

--Barton
_______________________________________________
Koha-devel mailing list
Koha-devel@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to