X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=marc_sf.pm;h=4da5eae752089d48686d83ff9a448601c5fd9828;hb=da4562f447dcd048e2f7d73b50038f0b8414572c;hp=0cae11307cef126d4e111442eeddbbf646bbe80b;hpb=953e1aa32b27b7361ead42c55425766de7f047f3;p=webpac diff --git a/marc_sf.pm b/marc_sf.pm index 0cae113..4da5eae 100644 --- a/marc_sf.pm +++ b/marc_sf.pm @@ -10,9 +10,12 @@ sub marc_sf { my $i = shift @_ || 0; - my $rec = $main::cache->{marc_record} || die '$cache->{marc_record} is undefined!'; - - my @out = $marc->getvalue({record=>$rec,field=>$f,subfield=>$s}); + my @out; + if ($s) { + @out = $marc->subfield($f,$s); + } else { + @out = $marc->field($f)->as_string() if ($marc->field($f)); + } return $out[$i] if (@out && $out[$i]); }