/[webpac]/trunk/hash_sf.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/hash_sf.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/isis_sf.pm revision 10 by dpavlin, Thu Jan 16 17:35:54 2003 UTC trunk/hash_sf.pm revision 678 by dpavlin, Sun Feb 27 23:07:35 2005 UTC
# Line 1  Line 1 
1  #  #
2  # isis_sf($isis_row,'isis_field'[,'subfield'])  # hash_sf($row_data,'field'[,'subfield'])
3  #  #
4  # e.g. isis_sf($row,'700','a')  # e.g. hash_sf($row,'700','a')
5  #  #
6  sub isis_sf {  sub hash_sf {
7          my $row = shift @_;          my $row = shift @_;
8          my $isis_id = shift @_;          my $field = shift @_;
9          my $subfield = shift @_;          my $subfield = shift @_;
10    
11          if ($row->{$isis_id}->[0]) {          my $i = shift @_ || 0;
12                  my $sf = OpenIsis::subfields($row->{$isis_id}->[0]);  
13                  if (! defined $subfield || length($subfield) == 0) {          my $out;
14    
15            if ($row->{$field}->[$i]) {
16                    if (! $subfield) {
17                          # subfield list undef, empty or no defined subfields for this record                          # subfield list undef, empty or no defined subfields for this record
18                          my $all_sf = $row->{$isis_id}->[0];                          my $all_sf = $row->{record}->{$field}->[$i] || confess "can't find field $field:$i",Dumper($row);
19                          $all_sf =~ s/\^./ /g;   nuke definirions                          $all_sf =~ s/[\^\$]./ /g;   # nuke definitions
20                          return $all_sf;                          return $all_sf;
                 } elsif ($sf->{$subfield}) {  
                         return $sf->{$subfield};  
21                  }                  }
22                    my $sf = $row->{$field}->[$i]->{$subfield};
23                    return $sf if ($sf);
24          }          }
25  }  }
26    

Legend:
Removed from v.10  
changed lines
  Added in v.678

  ViewVC Help
Powered by ViewVC 1.1.26