<!-- Presentation generated by Internet Assistant for Microsoft PowerPoint 97 -->
<HTML>
<HEAD>
<meta name="GENERATOR" content="Microsoft Internet Assistant for Microsoft PowerPoint 97">
<TITLE>Catching the Exception</TITLE>
</HEAD>
<BODY >
<CENTER>
<TABLE WIDTH=100%>
<TR> <TD WIDTH=100% ALIGN=CENTER>
<A HREF="sld001.htm">First</A>
<A HREF="sld044.htm">Previous</A>
<A HREF="sld046.htm">Next</A>
<A HREF="sld102.htm">Last</A>
<A HREF="index.htm">Index</A>
<A HREF="dbi.perl.org">Home</A>
<A HREF="tsld045.htm">Text</A>
</TD> </TR>
<TR> <TD WIDTH=100% ALIGN=CENTER>
<IMG SRC="img045.gif" usemap="#Objmap" WIDTH=800 HEIGHT=600 BORDER=0>
</TD> </TR>
</TABLE>
<P>Slide 45 of 102</P>
</CENTER>
<!-- <UL>
<H2>Catching the Exception</H2>
</UL></P>
<P><UL>
<LI><H2>Life after death
</H2>
<UL>
$h->{RaiseError} = 1;
<BR><BR>eval {
<BR> foo();
<BR> $h->method; # if it fails then the DBI calls die
<BR> bar($h); # may also call DBI methods
<BR>};
<BR>if ($@) { # $@ holds error message
<BR> ... handle the error here
<BR>}
<UL>
<BR></UL></UL></UL><UL>
<LI><H2>Bonus
</H2>
<UL>
<LI>Other, non-DBI, code within the eval block may also raise an exception
<LI>that will also be caught and can be handled cleanly
</UL></UL><UL>
<H2>.</H2>
</UL></P>
<P> -->
</Body>
</HTML>