Hi, I got a little problem, I made a script that work pretty well in the command line, but when I put it on the server, half the code is printed, and there's no error message.
#################### CGI ###########################
local ($buffer, @pairs, $pair, $name, $value, %FORM); # Read in text $ENV{'REQUEST_METHOD'} =~ tr/a-z/A-Z/; if ($ENV{'REQUEST_METHOD'} eq "GET") { $buffer = $ENV{'QUERY_STRING'}; } # Split information into name/value pairs @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%(..)/pack("C", hex($1))/eg; $FORM{$name} = $value; } $game = $FORM{game}; $tutorial = $FORM{tutorial}; print "Content-type:text/html\r\n\r\n";
################### Perl ###########################
####################################################if (defined($game) && $game !~ m/general|announcement|announcements|do +om3mod|events|finalmap|friends|games|general|hl2mod|pc|recycle|teammo +d|test/) { my $file = "forums/boards/".$game.".txt"; open (my $fh, $file) or die "Can't open $file :$!"; while (defined($line = <$fh>)) { @elements = split(/\|/,$line); print "</var><a href=\"http://www.my-domain.com/tutori +als.pl?tutorial=".$elements[0].">".$elements[1]."<a> Wrote by ".$elem +ents[2]."<br/>"; } }
I enter a key/value in the browser, if I print the value, it get out fine, if there's no value, the else work fine, but if there's a matching value, it enter the if and it block there. I am guessing it is the while that cause the problem, But I can't find how to fix it, and I don't see why it was working in the command line without error, and not on the server.
The files is at the right location, everything is the same, there's absolutly no error, it just doesn't print anything after the IF, if I entered a matching key/value in the broswer...
Someone could help me? :(
In reply to Running in Terminal, but not on Server by ShaZe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |