my @files; # stores working files my @contend; # stores files for 2. run if(-d $site->{PATH}) { # path points to folder my $fldr = $site->{PATH}; # get all file names in folder @files = <$fldr/*.xml>; } else { # path points to a single file @files = $site->{PATH}; } foreach my $fl (@files) { # for all files in path %ret = &getAttribs($site->{FILETYP}, $fl, \$logger); while ( my($key, $value) = each(%ret) ) { # log all return values $logger->debug("$key -> $value"); } if($ret_ref->{ec} eq '251') { # missing field in xml file? unshift(@wrongs, $fl); # store file name in error array } if($ret_ref->{ec} eq '250') { # file not redeable or does not exist $logger->error("$fl: return code $ret_ref->{ec}"); &WayOut('250', $logger); # go out } # select sub depended from FILETYP my $help = &{ $fkt_ref->{$fltype} }($ret_ref, \$logger); my $desc ="db error"; if($help < 0) { $desc = "$fltype $help: exist, skipped"; # do not store file name } elsif($help > 0) { $desc = "$fltype $help: inserted"; push @contend, $fl; # store file name for 2. run } elsif($help == 0) { # something is wrong, log unshift(@wrongs, $fl); $desc = "$fltype $help: error, not stored"; } $logger->debug("$fl: result $desc"); &storeWork($fl, $desc, \$logger); } given ($fltype) { when("package") { $logger->debug("no 2. run"); } when("profile") { $logger->debug("2. run required!"); my $sp_ret = 0; foreach my $cont (@contend) { $sp_ret = &storeContend($cont, $site->{OS}, \$logger); if($sp_ret == 255) { unshift(@wrongs, $cont); # store file in error array } } } when("host") { $logger->debug("no 2. run"); } when("log") { $logger->debug("no 2. run"); } } if(@wrongs > 0) { # print file names with problems $logger->info("found files with errors. Check logfile."); foreach my $wrong (@wrongs) { $logger->debug("wrong: $wrong"); } } else { $logger->info("found no files with errors."); } &closeDatabase(\@toClose, \$dbh); &WayOut('0', $logger); # program end