log warning about missing files
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 9 Jun 2009 21:36:22 +0000 (21:36 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 9 Jun 2009 21:36:22 +0000 (21:36 +0000)
git-svn-id: svn+ssh://mjesec/home/dpavlin/svn/webpac2/trunk@1219 07558da8-63fa-0310-ba24-9fe276d99e06

vhost/webpac2.cgi

index 83c658d..838cfd9 100755 (executable)
@@ -109,7 +109,12 @@ my $db = $config->{databases}->{$database};
 sub read_config_txt {
        my ( $file ) = @_;
        my $input;
-       foreach ( split(/[\n\r]+/, read_file( "$dir/$path/$path-$file.txt" ) ) ) {
+       my $path ="$dir/$path/$path-$file.txt";
+       if ( ! -e $path ) {
+               warn "missing $path";
+               return;
+       }
+       foreach ( split(/[\n\r]+/, read_file( $path ) ) ) {
                my ( $val,$label ) = split(/\s*\t\s*/,$_,2);
                push @{ $input->{ '-values' } }, $val;
                                $input->{ '-labels' }->{$val} = $label;