160 |
if ( my $regex = $self->{delimiters_regex} ) { |
if ( my $regex = $self->{delimiters_regex} ) { |
161 |
|
|
162 |
foreach my $v (@{ $rec->{$f} }) { |
foreach my $v (@{ $rec->{$f} }) { |
|
warn "## v = ", dump( $v ); |
|
163 |
my $l = _pack_subfields_hash( $v, 1 ); |
my $l = _pack_subfields_hash( $v, 1 ); |
|
warn "## $l [$regex]\n"; |
|
164 |
my $template = ''; |
my $template = ''; |
165 |
$l =~ s/$regex/$template.=$1/eg && warn "## new: $l\n"; |
$l =~ s/$regex/$template.=$1/eg; |
166 |
warn "## template: $template\n"; |
# warn "## template: $template\n"; |
167 |
$self->{_delimiters_templates}->{$f}->{$template}++ if ( $template ); |
$self->{_delimiters_templates}->{$f}->{$template}++ if ( $template ); |
168 |
} |
} |
169 |
|
|
405 |
|
|
406 |
} |
} |
407 |
|
|
408 |
|
=head2 delimiters_templates |
409 |
|
|
410 |
|
|
411 |
|
=cut |
412 |
|
|
413 |
|
sub delimiters_templates { |
414 |
|
my $self = shift; |
415 |
|
|
416 |
|
my $t = $self->{_delimiters_templates}; |
417 |
|
|
418 |
|
my $log = $self->_get_logger; |
419 |
|
|
420 |
|
unless ($t) { |
421 |
|
$log->warn("called without delimiters"); |
422 |
|
return; |
423 |
|
} |
424 |
|
|
425 |
|
my $out; |
426 |
|
|
427 |
|
foreach my $f (sort { $a <=> $b } keys %$t) { |
428 |
|
$out .= "$f\n"; |
429 |
|
foreach my $sft (sort { $a cmp $b } keys %{ $t->{$f} }) { |
430 |
|
$out .= "\t" . $t->{$f}->{$sft} . "\t$sft\n"; |
431 |
|
} |
432 |
|
} |
433 |
|
|
434 |
|
return $out; |
435 |
|
} |
436 |
|
|
437 |
=head1 AUTHOR |
=head1 AUTHOR |
438 |
|
|
439 |
Dobrica Pavlinusic, C<< <dpavlin@rot13.org> >> |
Dobrica Pavlinusic, C<< <dpavlin@rot13.org> >> |