Hallo.
Ich habe ein Problem mit einem Perl-Script.
Es handelt sich dabei um ein Such-Script, das, wenn es einen Suchbegriff findet, einwandfrei läuft. Wird ein Suchbegriff nicht gefunden, bricht das Script ab und es kommt folgende Fehlermeldung:
"Premature end of script headers"
Auf einem T-online Server ist es komplett einwandfrei gelaufen, nun habe ich einen Provider-Wechsel unternommen und auf diesem Server macht das Script oben genannten Fehler.
Habe auch schon mit Text-Pad dieses Script auf Unix abgespeichert. Die Rechte stimmen auch.
Könntet Ihr mir da bitte helfen?.
Für Eure Mühe danke ich Euch schon im Voraus.
Hier das Script:
#!/bin/perl -w
print "Content-type:text/html\n\n";
use CGI::Carp(fatalsToBrowser);
$directory="/htdocs/www/";
$url="http://www.wollaberg.de/";
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
@ORIG=("Ü","Ä","Ö","ü","ä","ö","ß");
@SUBST=("Ü","Ä","Ö","ü","ä","ö","ß");
for ($i=1; $i<3; $i++) {
$string="qry$i";
for ($x=0; $x<7; $x++) {
$FORM{$string} =~ s/$ORIG[$x]/$SUBST[$x]/g;
}
}
push(@DIRS, "$directory");
opendir(TEMP, $directory);
while($file = readdir(TEMP)) {
push(@DIRS, "$directory$file/") if -d $file && $file ne ".." && $file ne "." && $file !~ /^_/ && $file ne "cgi-bin";
}
close (TEMP);
foreach $dirs (@DIRS) {
chdir($dirs);
opendir(TEMP, $dirs);
while($file = readdir(TEMP)) {
push(@FILES, "$dirs$file") if -T $file;
push(@DIRS, "$dirs$file/") if -d $file && $file ne ".." && $file ne "." && $file !~ /^_/ && $file ne "cgi-bin";
}
close (TEMP);
}
foreach $FILE (@FILES) {
$counter{$FILE}++;
}
foreach $FILE (sort keys(%counter)) {
push(@SORTFILES, $FILE);
}
@FILES=@SORTFILES;
chdir($directory);
foreach $FILE (@FILES) {
open(FILE, "$FILE");
@LINES= <FILE>;
close(FILE);
$string = join(' ', @LINES);
$string =~ s/\n//g;
if ($FORM{operator} eq "und") {
if ($string =~ /$FORM{qry1}/i && $string =~ /$FORM{qry2}/i ) {
$include{$FILE} = "yes";
}
else {
$include{$FILE} = "no";
}
}
if ($FORM{operator} eq "oder") {
if ($string =~ /$FORM{qry1}/i || $string =~ /$FORM{qry2}/i) {
$include{$FILE} = "yes";
}
else {
$include{$FILE} = "no";
}
}
if ($string =~ /<title>(.*)</title>/i && $1 ne "") {
$titles{$FILE} = "$1";
}
else {
$ausgabe=$FILE;
$ausgabe =~ s/^$directory//;
$titles{$FILE} = "$url$ausgabe";
}
}
print <<marke1;
<html>
<head>
<title>Suchergebnisse</title>
<copyright by Roland Plank>
<style type="text/css">
</style>
</head>
<body text="#000000" bgcolor="#CCFFFF" link="#990066" vlink="#990066" alink="#990066">
<p><center>
<table>
<tr>
<td>
<font size=+1><b>Suchergebnisse in der Datenbank Wollaberg
</td>
</tr>
</table>
</center>
<p><br><p><br>
<center>
<table border=1 width=95%>
<tr>
<td>
<ul>
<b><font size=4>Es wurde gesucht nach: <i>$FORM{qry1}</i>
marke1
if ($FORM{qry2} ne "") {
$FORM{operator} =~ tr/a-z/A-Z/;
print "$FORM{operator} $FORM{qry2}\n";
}
print <<marke2;
</b>
<p>
<font size=3>Fundstellen in folgenden Dateien:<p>
<font size=3>
<ul>
marke2
foreach $FILE (@FILES) {
if ($include{$FILE} eq 'yes') {
$y++;
$ausgabe = $FILE;
$ausgabe =~ s/^$directory//;
print "<a href="$url$ausgabe"><b>$titles{$FILE}</a></b><br>\n";
}
}
if ($y==0)
{
print "<b><font color=red>Leider keine Entsprechungen gefunden!</font></b><br>\n";
}
print "<p></td></tr></table><p>
<font size=-1>
<br>
<a href='javascript:history.back()'>zurück</a>
<p></body></html>\n";