+ marc_template must use marc_indicators data
+ indicator(field,nr) nr=1|2 for MARC input -> rec(field,'i1') or rec(field,'i2')
+ validator don't accept 0 as valid subfield
++ subroutines gets mungled in normalization files [2.33]
- rewrite WebPAC::Input to be based on Module::Pluggable
- check usage of config in normalize file (database, input name?)
- load_ds/save_ds should use on-disk hash to preserve inodes
my ($Document,$Element) = @_;
$Element->isa('PPI::Token::Word') or return '';
+
+ if ( $Element->content eq 'sub' ) {
+ # repair demage done by prune of whitespace
+ $Element->insert_after( PPI::Token::Whitespace->new(' ') );
+ return '';
+ }
+
$Element->content eq 'lookup' or return '';
$log->debug("expansion: ", $Element->snext_sibling);
}
$e[7]->remove;
- $e[8]->insert_before( new PPI::Token::Quote::Single( "'$key'" ) );
+ $e[8]->insert_before( PPI::Token::Quote::Single->new( "'$key'" ) );
$e[8]->remove;
use strict;
use blib;
-use Test::More tests => 55;
+use Test::More tests => 60;
use YAML qw/LoadFile/;
diag "_normalize_source = ",dump($n) if ($debug);
foreach my $db (keys %$n) {
foreach my $i (keys %{$n->{$db}}) {
- ok(my $r = $parser->normalize_rules($db,$i), "normalize_source($db/$i)");
+ ok(my $r = $parser->normalize_rules($db,$i), "normalize_rules($db/$i)");
diag "normalize_rules($db,$i) = $r" if ($debug);
cmp_ok($n->{$db}->{$i}, 'eq', $r, "same");
}
ok(-e $config_path, "$config_path exists");
ok(
- my $parser = new WebPAC::Parser(
+ $parser = new WebPAC::Parser(
config => new WebPAC::Config( path => $config_path ),
base_path => $abs_path,
%LOG,
marc_repeatable_subfield => 1,
}, 'catched all marc_*');
+
+$config_path = "$abs_path/conf/sub.yml";
+
+ok(-e $config_path, "$config_path exists");
+
+ok(
+ $parser = new WebPAC::Parser(
+ config => new WebPAC::Config( path => $config_path ),
+ base_path => $abs_path,
+ %LOG,
+), "new");
+
+ok(my $rules = $parser->normalize_rules('sub','sub-input'), "normalize_rules(sub)");
+
+diag "rules: $rules" if $debug;
+
+our @test;
+eval $rules;
+diag "test = ",dump( @test ) if $debug;
+
+ok(! $@, "eval: $@" );
+
+is_deeply( [ @test ], [ "foo", "foo", "bar >>2<<", "bar >>42<<" ], 'sub executed' );
+