21 |
get set |
get set |
22 |
count |
count |
23 |
|
|
24 |
|
row |
25 |
|
rec_array |
26 |
|
|
27 |
/; |
/; |
28 |
|
|
29 |
use warnings; |
use warnings; |
50 |
marc_template |
marc_template |
51 |
/); |
/); |
52 |
|
|
53 |
|
use Storable qw/dclone/; |
54 |
|
|
55 |
=head1 NAME |
=head1 NAME |
56 |
|
|
57 |
WebPAC::Normalize - describe normalisaton rules using sets |
WebPAC::Normalize - describe normalisaton rules using sets |
153 |
|
|
154 |
sub _get_rec { $rec }; |
sub _get_rec { $rec }; |
155 |
|
|
156 |
|
sub rec_array { |
157 |
|
my $d = $rec->{ $_[0] }; |
158 |
|
return @$d if ref($d) eq 'ARRAY'; |
159 |
|
die "field $_[0] not array: ",dump( $d ); |
160 |
|
} |
161 |
|
|
162 |
=head2 _set_config |
=head2 _set_config |
163 |
|
|
164 |
Set current config hash |
Set current config hash |
355 |
|
|
356 |
sub sorted { to( 'sorted', @_ ) } |
sub sorted { to( 'sorted', @_ ) } |
357 |
|
|
358 |
|
=head2 row |
359 |
|
|
360 |
|
Insert new row of data into output module |
361 |
|
|
362 |
|
row( column => 'foo', column2 => 'bar' ); |
363 |
|
|
364 |
|
=cut |
365 |
|
|
366 |
|
use Data::Dump qw/dump/; |
367 |
|
|
368 |
|
sub row { |
369 |
|
die "array doesn't have odd number of elements but $#_: ",dump( @_ ) if $#_ % 2 == 1; |
370 |
|
my $table = shift @_; |
371 |
|
push @{ $out->{'_rows'}->{$table} }, {@_}; |
372 |
|
} |
373 |
|
|
374 |
|
|
375 |
=head1 Functions to extract data from input |
=head1 Functions to extract data from input |
376 |
|
|
391 |
|
|
392 |
warn "## _pack_subfields_hash( ",dump(@_), " )\n" if ($debug > 1); |
warn "## _pack_subfields_hash( ",dump(@_), " )\n" if ($debug > 1); |
393 |
|
|
394 |
my ($h,$include_subfields) = @_; |
my ($hash,$include_subfields) = @_; |
395 |
|
|
396 |
# sanity and ease of use |
# sanity and ease of use |
397 |
return $h if (ref($h) ne 'HASH'); |
return $hash if (ref($hash) ne 'HASH'); |
398 |
|
|
399 |
|
my $h = dclone( $hash ); |
400 |
|
|
401 |
if ( defined($h->{subfields}) ) { |
if ( defined($h->{subfields}) ) { |
402 |
my $sfs = delete $h->{subfields} || die "no subfields?"; |
my $sfs = delete $h->{subfields} || die "no subfields?"; |