J
John Smith said:Today however, I was asked to write another perl script for another
project. This will be running on a different machine and
unfortunately, I don't have much info, I think it may be a on a sun
system? Anyway, after some debugging, I found that my script
crashes when I use a scalar that has a null value. For example:
$temp=$ENV{'QUERY_STRING'};
@pairs=split(/&/,$temp);
The first line is not a problem, but if the QUERY_STRING environment
is empty, the second line will crash.
Does anyone know how I could fix this?
I've been writing a little perl in the past few years, for web server
= CGI scripts to be more precise. Currently I am writing a script
which is = running on a Linux machine with Apache web server with Perl
5.6. This is = running great for me.
Today however, I was asked to write another perl script for another =
project. This will be running on a different machine and
unfortunately, = I don't have much info, I think it may be a on a sun
system? Anyway, = after some debugging, I found that my script
crashes when I use a scalar = that has a null value. For example:
$temp=3D$ENV{'QUERY_STRING'};
@pairs=3Dsplit(/&/,$temp);
The first line is not a problem, but if the QUERY_STRING environment
is = empty, the second line will crash.=20
In my script, this is used to read any parameters that were sent to
the = script from web browser URL, such as =
http://www.domain.com/cgi-bin/app.pl?year=3D2003. And it works if
there = are parameters, but if someone uses their web browser to
access = http://www.domain.com/cgi-bin/app.pl, there are no
parameters, the = QUERY_STRING environment is null, $temp is null and
crash!
The above is just one example. The following will do the same:
my $temp;
if($temp=3D=3D0){$a=3D1;}
In both cases, the $temp scalar is empty (or null) and it causes my =
script to crash. I have never seen this happen before, and it is not =
happening in my other projects, only on this server. I can work around
= this so far, but it would make life so much simpler if it wouldn't
be = doing this.
Does anyone know how I could fix this?
$temp=$ENV{'QUERY_STRING'};
@pairs=split(/&/,$temp);
Eric J. Roode said:Please do not post
MIME/multipart articles to usenet.
Tad McClellan said:Oh. That explains why I'm seeing followups without having seen the OP.
Steven Smolinski said:Could you share your scorefile entry for this amazing feature? I've
tried to score on the Content-Type: multipart/alternative header, but
for some reason I cannot fathom it does not catch posts like this.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.