Subject: | Bug in MARC::Record |
Date: | Mon, 09 Apr 2012 14:46:55 -0400 |
To: | <bug-MARC-Record [...] rt.cpan.org> |
From: | "Chris Cooke, Contractor, Code 5596" <chris.cooke.ctr [...] nrl.navy.mil> |
There is a bug in MARC::Record when you use the form:
my $title = $marc->field('245')->subfield("a");
The problem is that if the field 245 is not defined, then you get a "Can't
call method "subfield" on an undefined value at..." error. I have just
started to use this module, and noticed this right away on a record with an
undefined isbn. This problem does not seem to exist in the form:
my $title = $marc->subfield('245', "a");
In my program,
$record{$isbn} = $marc->field('20')->subfield('a');
Crashes, but
$record{$isbn} = $marc->subfield('20', 'a');
Is fine.
The documentation on CPAN states that these two methods are equivalent, but
they are not.
-Chris