From 57eba35fd24e5b710043772a8de1647e9b3963c3 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Sat, 23 Oct 2010 01:18:08 +0200 Subject: [PATCH] report invalid databases --- server.pl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/server.pl b/server.pl index 8d7c60d..2f834dc 100755 --- a/server.pl +++ b/server.pl @@ -41,8 +41,14 @@ diag "SearchHandle ",Dumper($this); my $rpn = $this->{RPN}; my $query; - my $database = $this->{DATABASES}->[0]; - my $module = $databases->{$database} || 'COBISS'; + my $database = uc $this->{DATABASES}->[0]; + my $module = $databases->{$database}; + if ( ! defined $module ) { + $this->{ERR_CODE} = 108; + warn $this->{ERR_STR} = "unknown database $database - available: " . keys %$databases; + return; + } + my $from = $module->new; diag "using $module for $database ", Dumper( $from ); -- 2.20.1