/[webpac2]/trunk/lib/WebPAC/Normalize.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/lib/WebPAC/Normalize.pm

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

revision 1066 by dpavlin, Tue Nov 27 22:31:09 2007 UTC revision 1205 by dpavlin, Fri May 29 20:32:13 2009 UTC
# Line 47  push @EXPORT, ( qw/ Line 47  push @EXPORT, ( qw/
47          marc_template          marc_template
48  /);  /);
49    
50    use Storable qw/dclone/;
51    
52  =head1 NAME  =head1 NAME
53    
54  WebPAC::Normalize - describe normalisaton rules using sets  WebPAC::Normalize - describe normalisaton rules using sets
# Line 148  sub _set_ds { Line 150  sub _set_ds {
150    
151  sub _get_rec { $rec };  sub _get_rec { $rec };
152    
153    sub rec_array {
154            my $d = $rec->{ $_[0] };
155            return @$d if ref($d) eq 'ARRAY';
156            die "field $_[0] not array: ",dump( $d );
157    }
158    
159  =head2 _set_config  =head2 _set_config
160    
161  Set current config hash  Set current config hash
# Line 344  Insert into lists which will be automati Line 352  Insert into lists which will be automati
352    
353  sub sorted { to( 'sorted', @_ ) }  sub sorted { to( 'sorted', @_ ) }
354    
355    =head2 row
356    
357    Insert new row of data into output module
358    
359      row( column => 'foo', column2 => 'bar' );
360    
361    =cut
362    
363    use Data::Dump qw/dump/;
364    
365    sub row {
366            die "array doesn't have even number of elements but $#_: ",dump( @_ ) if $#_ % 2 != 1;
367    
368            push @{ $out->{'_rows'} }, {@_};
369    }
370    
371    
372  =head1 Functions to extract data from input  =head1 Functions to extract data from input
373    
# Line 364  sub _pack_subfields_hash { Line 388  sub _pack_subfields_hash {
388    
389          warn "## _pack_subfields_hash( ",dump(@_), " )\n" if ($debug > 1);          warn "## _pack_subfields_hash( ",dump(@_), " )\n" if ($debug > 1);
390    
391          my ($h,$include_subfields) = @_;          my ($hash,$include_subfields) = @_;
392    
393          # sanity and ease of use          # sanity and ease of use
394          return $h if (ref($h) ne 'HASH');          return $hash if (ref($hash) ne 'HASH');
395    
396            my $h = dclone( $hash );
397    
398          if ( defined($h->{subfields}) ) {          if ( defined($h->{subfields}) ) {
399                  my $sfs = delete $h->{subfields} || die "no subfields?";                  my $sfs = delete $h->{subfields} || die "no subfields?";

Legend:
Removed from v.1066  
changed lines
  Added in v.1205

  ViewVC Help
Powered by ViewVC 1.1.26