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

<HTML>

<HEAD>

<meta name="GENERATOR" content="Microsoft Internet Assistant for PowerPoint 97">
 <TITLE>Custom Error Handling</TITLE> 
</HEAD>

<BODY     >

 <H1>Custom Error Handling</H1> 
 <P><UL>
<LI><H2>Don’t want to just Print or Raise an Error?
</H2>
<UL>
<LI>Now you can Handle it as well…
<UL>
$h-&#062{HandleError} = sub { … };
<BR><BR>
</UL></UL></UL><UL>
<LI><H2>The HandleError code
</H2>
<UL>
<LI>is called just before PrintError/RaiseError are handled
<LI>it’s passed
<UL>
<LI>the error message string that RaiseError/PrintError would use
<LI>the DBI handle being used
<LI>the first value being returned by the method that failed (typically undef)
</UL><LI>if it returns false then RaiseError/PrintError are checked and acted upon as normal
</UL></UL><UL>
<LI><H2>
</H2>
</UL><UL>
<LI><H2>The handler code can
</H2>
<UL>
<LI>alter the error message text by changing $_[0]
<LI>use caller() or Carp::confess() or similar to get a stack trace
<LI>use Exception or a similar module to throw a formal exception object</UL></UL></P>
<P></P> 
<P>
<TABLE>
  <TD HEIGHT=100 WIDTH=100> <A HREF="tsld046.htm">Previous slide</A> </TD>
  <TD HEIGHT=100 WIDTH=100> <A HREF="tsld048.htm">Next slide</A> </TD>
  <TD HEIGHT=100 WIDTH=150> <A HREF="tsld001.htm">Back to first slide</A> </TD>
  <TD HEIGHT=100 WIDTH=150> <A HREF="sld047.htm">View graphic version</A> </TD>
</TABLE>
<BR>
</P>



</Body>
</HTML>