Changed delimiter_templates arguments to be more intuitive,
disable MARC generation when running delimiters validation
(this is just disk overhead)
git-svn-id: svn+ssh://mjesec/home/dpavlin/svn/webpac2/trunk@851
07558da8-63fa-0310-ba24-
9fe276d99e06
my $report = $validate->delimiter_teplates(
report => 1,
- accumulated => 1,
+ current_input => 1,
);
Options:
Generate humanly readable report with single fields
-=item accumulated
+=item current_input
-Use accumulated data from all inputs
+Report just current_input and not accumulated data
=back
my $args = {@_};
- my $t;
- if ( $args->{accumulated} ) {
- $t = $self->{_accumulated_delimiters_templates};
- } else {
- $t = $self->{_delimiters_templates};
- }
+ my $t = $self->{_accumulated_delimiters_templates};
+ $t = $self->{_delimiters_templates} if ( $args->{current_input} );
my $log = $self->_get_logger;
$path .= '.new' if ( -e $path );
open(my $d, '>', $path) || $log->fatal("can't open $path: $!");
- print $d $self->delimiters_templates( accumulated => 1 );
+ print $d $self->delimiters_templates;
close($d);
$log->info("new delimiters templates saved to $path");
"help" => \$help,
);
+$marc_generate = 0 if ( $validate_delimiters_path );
+
pod2usage(-verbose => 2) if ($help);
my $config = new WebPAC::Config( path => $config_path );
print $report_fh "$errors\n" if ($report_fh);
}
- print $report_fh "\nAll possible subfields/delimiter templates:\n", $validate->delimiters_templates( report => 1 ), "\n\n";
+ print $report_fh "\nAll possible subfields/delimiter templates:\n", $validate->delimiters_templates( report => 1, current_input => 1 ), "\n\n";
+
+ # must be last thing that touches $validate for this input
+ $validate->reset;
}
if ($stats) {
# close report
close($report_fh) if ($report_fh);
-
- # reset validate stats
- $validate->reset if ( $validate );
}
eval { $indexer->finish } if ($indexer && $indexer->can('finish'));
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 13;
+use Test::More tests => 15;
use Test::Exception;
use blib;
901 => { "^a : / ^b" => 2 },
}, 'just subfields and delimiters');
-ok(my $dt = $v->delimiters_templates, 'delimiters_template');
+ok(! $v->delimiters_templates, 'no accumulated delimiters_template');
+
+ok(my $dt = $v->delimiters_templates( current_input => 1 ), 'delimiters_template');
diag $dt if ( $debug );
-ok($dt = $v->delimiters_templates( report => 1 ), 'delimiters_template report');
+ok($dt = $v->delimiters_templates( report => 1, current_input => 1 ), 'delimiters_template report');
diag $dt if ( $debug );
+$v->reset;
+ok( $v->delimiters_templates, 'have accumulated delimiters_templates');
+
$v->{_validate_delimiters_templates} = {
900 => { '^a : ^b' => 1 },
};