Siegfried Heintze wrote:
I have the following code (extracted from my cgi program) and I am expecting
it to display an error message when it hits the "if ($@){...}" as a result
of hitting the "die" statement. It does not (as indicated by single stepping
with the windows perl debugger)! Instead it takes the else! Why?

Did you try the code snippet below as posted? It runs as expected here.


I'm using ActiveSTate 5.8+. I tried perldoc.bat -f die but did not find any
clues to my problem.

eval{

          die "No valid ID for User";
};
if($@){

However, you probably want to save the error:

if ( my $err = $@ ) {

print start_html(-title => "Error: $case_name",
-onload => "BodyLoad();",
-style => {"src"=>"../../css/convex.css"}
), p("<h1> Error: $@");

And change this to:

   p("<h1> Error: $err");

because $@ has been reset by the time you get here.

  print concat( [EMAIL PROTECTED]);
} else {

}

Thanks,
Siegfried



Randy.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to