From b3c448cbf51dabb342e31250ff822230f81a7686 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Fri, 3 Nov 2006 19:41:28 +0000 Subject: [PATCH] r1117@llin: dpavlin | 2006-11-03 20:42:24 +0100 cleanup API a bit. validate_errors in now validate_rec [0.10] git-svn-id: svn+ssh://mjesec/home/dpavlin/svn/webpac2/trunk@768 07558da8-63fa-0310-ba24-9fe276d99e06 --- lib/WebPAC/Validate.pm | 12 ++++++------ run.pl | 2 +- t/1-validate.t | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/WebPAC/Validate.pm b/lib/WebPAC/Validate.pm index ec336a6..55dc374 100644 --- a/lib/WebPAC/Validate.pm +++ b/lib/WebPAC/Validate.pm @@ -18,11 +18,11 @@ WebPAC::Validate - provide simple validation for records =head1 VERSION -Version 0.09 +Version 0.10 =cut -our $VERSION = '0.09'; +our $VERSION = '0.10'; =head1 SYNOPSIS @@ -117,20 +117,20 @@ sub new { $self ? return $self : return undef; } -=head2 validate_errors +=head2 validate_rec Validate record and return errors - my @errors = $validate->validate_errors( $rec, $rec_dump ); + my @errors = $validate->validate_rec( $rec, $rec_dump ); =cut -sub validate_errors { +sub validate_rec { my $self = shift; my $log = $self->_get_logger(); - my $rec = shift || $log->logdie("validate_errors need record"); + my $rec = shift || $log->logdie("validate_rec need record"); my $rec_dump = shift; $log->logdie("rec isn't HASH") unless (ref($rec) eq 'HASH'); diff --git a/run.pl b/run.pl index 54220fc..0d00baa 100755 --- a/run.pl +++ b/run.pl @@ -477,7 +477,7 @@ while (my ($database, $db_config) = each %{ $config->databases }) { if ($validate) { - if ( my $errors = $validate->validate_errors( $row, $input_db->dump ) ) { + if ( my $errors = $validate->validate_rec( $row, $input_db->dump ) ) { $log->error( "MFN $mfn validation error:\n", $validate->report_error( $errors ) ); diff --git a/t/1-validate.t b/t/1-validate.t index c6abeec..52957c5 100755 --- a/t/1-validate.t +++ b/t/1-validate.t @@ -37,7 +37,7 @@ is_deeply( $v->{rules}, { -throws_ok { $v->validate_errors() } qr/rec/, "validate_rec need rec"; +throws_ok { $v->validate_rec() } qr/rec/, "validate_rec need rec"; sub test_v { my $row = shift || die "no row?"; @@ -47,7 +47,7 @@ sub test_v { $row->{'000'} = [ 42 ]; $v->reset_errors; - my $e = $v->validate_errors( $row ); + my $e = $v->validate_rec( $row ); diag "validate $d\n",dump($e) if ($debug); -- 2.20.1