13 Jun
2018
13 Jun
'18
6:23 p.m.
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