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 |
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 |
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 |
|
|
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?"; |