sub choosetemplate { my($filepath) = @_; $templatepath = $filepath; $templatepath =~ s|source/||; @templatepath = split("/", $templatepath); $template = "templates/" . join("/", @templatepath) . "/$filename"; $template =~ s|\.xml$|\.t|; $template =~ s|//|/|g; if(! -e $template) { $template =~ s|[0-9]+\.t$|\.t|; } if(! -e $template) { while(@templatepath && (! -e $template)) { $template = "templates/" . join("/", @templatepath) . "/files.t"; $template =~ s|//|/|g; pop @templatepath; } } if(! -e $template) { $template = "templates/files.t"; } } sub chooseparser { my($filepath) = @_; $parserpath = $filepath; $parserpath =~ s|source/||; @parserpath = split("/", $parserpath); $host = `pwd`; chomp $host; $host =~ s|/home/cms/(.*)|$1|; $parser = "$binpath/parsers/$host/" . join("_", @parserpath) . (@parserpath?"_":"") . "$filename"; $parser =~ s|\.xml$|\.pl|; if(! -e $parser) { $parser =~ s|[0-9]+\.pl$|\.pl|; } if(! -e $parser) { while(@parserpath && (! -e $parser)) { $parser = "$binpath/parsers/$host/" . join("_", @parserpath) . (@parserpath?"_":"") . "files.pl"; pop @parserpath; } } if(! -e $parser) { $parser = "$binpath/parsers/$host/files.pl"; } if(! -e $parser) { $parserpath = $filepath; $parserpath =~ s|source/||; @parserpath = split("/", $parserpath); $parser = "$binpath/parsers/default/" . join("_", @parserpath) . (@parserpath?"_":"") . "$filename"; $parser =~ s|\.xml$|\.pl|; if(! -e $parser) { $parser =~ s|[0-9]+\.pl$|\.pl|; } if(! -e $parser) { while(@parserpath && (! -e $parser)) { $parser = "$binpath/parsers/default/" . join("_", @parserpath) . (@parserpath?"_":"") . "files.pl"; pop @parserpath; } } if(! -e $parser) { $parser = "$binpath/parsers/default/files.pl"; } } } 1;