--- trunk/run.pl 2006/09/06 19:25:22 636 +++ trunk/run.pl 2006/09/11 11:57:18 664 @@ -12,7 +12,7 @@ use WebPAC::Store 0.03; use WebPAC::Normalize 0.11; use WebPAC::Output::TT; -use WebPAC::Validate; +use WebPAC::Validate 0.06; use WebPAC::Output::MARC; use YAML qw/LoadFile/; use Getopt::Long; @@ -60,8 +60,8 @@ =item --stats -disable indexing and dump statistics about field and subfield -usage for each input +disable indexing, modify_* in configuration and dump statistics about field +and subfield usage for each input =item --validate path/to/validation_file @@ -335,6 +335,12 @@ $input->{lookup} ? "lookup '$input->{lookup}'" : "" ); + if ($stats) { + # disable modification of records if --stats is in use + delete($input->{modify_records}); + delete($input->{modify_file}); + } + my $input_db = new WebPAC::Input( module => $input_module, encoding => $config->{webpac}->{webpac_encoding}, @@ -400,8 +406,11 @@ if ($validate) { - my @errors = $validate->validate_errors( $row ); - $log->error( "MFN $mfn validation errors:\n", join("\n", @errors) ) if (@errors); + if ( my $errors = $validate->validate_errors( $row, $input_db->dump ) ) { + $log->error( "MFN $mfn validation error:\n", + dump( $errors ) + ); + } } my $ds_config = dclone($db_config); @@ -454,6 +463,11 @@ $total_rows++; } + if ($validate) { + my $errors = $validate->report; + $log->info("validation errors:\n$errors\n" ) if ($errors); + } + $log->info("statistics of fields usage:\n", $input_db->stats) if ($stats); # close MARC file