The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

<!--  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>&nbsp;&nbsp;
         <A HREF="sld044.htm">Previous</A>&nbsp;&nbsp;
         <A HREF="sld046.htm">Next</A>&nbsp;&nbsp;
         <A HREF="sld102.htm">Last</A>&nbsp;&nbsp;
&nbsp;&nbsp;         <A HREF="index.htm">Index</A>&nbsp;&nbsp;
         <A HREF="dbi.perl.org">Home</A>&nbsp;&nbsp;
         <A HREF="tsld045.htm">Text</A>&nbsp;&nbsp;
     </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-&#062{RaiseError} = 1;
<BR><BR>eval {
<BR>	  foo();
<BR>	  $h-&#062method;		# 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>