Hi,
bin in Sachen Perl ein ziemlicher Newbie und hab folgendes Problem.
Hab ein laufendes Perl Skript das auf Linux einwandfrei läuft. Es beinhaltet ein Formular, das die Daten aus einer *.txt Datei ausliest und in Formularfeld einfügt. Jetzt hab ich auf meinem XP Rechner den xampp installiert und unter ../htdocs/cgi-bin das Perl Skript eingefügt. Unter ../htdocs/data hab ich die Textfile. Beim öffnen des Skripts liest er mir aber die Textfile nicht aus. Wie gesagt auf dem Linux Server läuft alles. Hier die Files:
index.pl:
#!C:\Perl\bin\perl.exe
print "Content-type: text/html\n\n";
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">', "\n";print "<html>\n";
print "\n\n";
print "<html>\n";
print "<head>\n";
print "<title>TEST</title>\n";
print "<link href=\"http://localhost/styles/main.css\" rel=\"STYLESHEET\" type=\"text/css\">\n";
print "</head>\n";
&getmychoices;
print "<body aLink=\"\#000000\" bgColor=\"\#F0F2FF\" bottomMargin=\"0\" leftMargin=\"0\" link=\"\#000000\"\n";
print "rightMargin=\"0\"\n";
print "style=\"BACKGROUND-IMAGE: url(http://localhost/images/blank.gif); BACKGROUND-REPEAT: repeat-y\"\n";
print "topMargin=\"0\" vLink=\"\#000000\" marginwidth=\"0\" marginheight=\"0\">\n";
print "\n";
print " <table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
print " <tr>\n";
print " <td><img src=\"http://localhost/images/pixel.gif\" width=\"80\" height=\"1\"><br>\n";
print " test1</td>\n";
print " <td></td>\n";
print " <td><font face=\"Arial\" size=\"2\"><select name=\"city\" size=\"1\">\n";
for(getchoices("stadt"))
{ print " <option value=\"$_\">$_</option>\n"; }
print " </select></font></td>\n";
print " </tr>\n";
print " <tr>\n";
print " <td>test2</td>\n";
print " <td></td>\n";
print " <td><font face=\"Arial\" size=\"2\"><select name=\"daten\" size=\"1\">\n";
for(getchoices("data"))
{
@typ_split = split(/\|\|/,$_);
print " <option value=\"$_\">@typ_split[0]</option>\n";
}
print "</td>\n";
print "</tr>\n";
print "</body>\n";
print "</html>\n";
sub getchoices
{
@back = "";
pop(@back);
$on = 0;
for(@mychoices)
{
if ($_ =~ /<\#$_[0]>/) { $on = 0; }
if ($on == 1) { push(@back,$_); }
if ($_ =~ /<$_[0]>/) { $on = 1; }
}
for (@back)
{
$_ =~ s/[\n]//;
}
return @back;
}
sub getmychoices
{
$self_name = substr($0,rindex($0,"\\")+1);
$self_path = substr($0,0,rindex($0,"\\")+1);
open(ALT, "/data/choices.txt");
while(<ALT>) { push(@choices,$_); }
close(ALT);
$on = 0;
for(@choices)
{
if ($_ =~ /<!!>end choices.+$self_name<!!>/) {$on = 0;}
if ($on == 1) { push(@mychoices,$_); }
if ($_ =~ /<!!>start choices.+$self_name<!!>/) {$on = 1;}
}
}
Und noch die Text datei ( choices.txt )
<!!>start choices for index.pl<!!>
<stadt>
paris
berlin
venedig
mailand
tokyo
havanna
<#stadt>
<data>
Aa||a
Bb||b
Cc||c
Dd||d
Ee||e
Ff||f
<#data>
<!!>end choices for index.pl<!!>
Für hilfe wär ich echt dankbar!
Tom