Error Server question

Hi,
I use this command :
@wUserInfo=`cocdir -u $wUserId` ; in my CGI perl program.
The problem is if the command "cocdir" find nothing,
It produce an "server error" message. How can I do
to know if it found nothing or do another command
before the program generate the web page that
display the "server error" message.

Thank.
woainiAsked:
Who is Participating?
 
ozoConnect With a Mentor Commented:
Ok.
0
 
ozoCommented:
if( $wUserInfo[0] =~ /server error/ )
0
 
woainiAuthor Commented:
It doesn't work.
Here are the message error :
-----
Server Error

This server has encountered an internal error which prevents it from fulfilling your request. The most likely cause is a misconfiguration. Please ask the administrator to look for messages in the server's error log.
-----
Any code after this line of code won't work
@wUserInfo=`cocdir -u $wUserId` ;

event "exit;"

So I need something inside this line of code
@wUserInfo=`cocdir -u $wUserId` ;
to prevent the browser to display the server error
message above. ex: die, etc...

Thank.
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
kaijenCommented:
I suggest looking at

ftp://ftp.uni-hamburg.de/pub/soft/lang/perl/CPAN/doc/FAQs/cgi/idiots-guide.html
http://reference.perl.com/query.cgi?cgi

to get some general understanding of how CGI works. Inspite of the name - the first link
is great!

If if( $wUserInfo[0] =~ /server error/ ) doesn't work,
if( $wUserInfo[0] =~ /server error/i ) probably will do.

Best regards, Kai.
0
 
woainiAuthor Commented:
It doesn'r work.
How can I use a condition "IF" under the code
line
@wUserInfo=`cocdir -u $wUserId` ;
if the browser has already generated the web
page server error message ?
That mean it not pass throught this line of code
@wUserInfo=`cocdir -u $wUserId` ;
So how can I do to stop it ? may be with "die" ? or
???
0
 
ozoCommented:
What does your CGI program do if you comment out the
# @wUserInfo=`cocdir -u $wUserId` ;
line?
And did you look for messages in the server error log?
0
 
ozoCommented:
#or try adding this to the top of your script:
open (STDERR, ">&STDOUT");
print "Content-type: text/plain\n\n";


0
 
woainiAuthor Commented:
Thank a lot Ozo ! how can I give you points ?
0
 
woainiAuthor Commented:
can you lock the question so I can give you the points.
Thank.
0
 
woainiAuthor Commented:
Thank a lot ozo !
0
 
ozoCommented:
You're welcome
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.