home *** CD-ROM | disk | FTP | other *** search
-
- <HTML>
- <HEAD>
- <TITLE>Tk::Error - Method invoked to process background errors</TITLE>
- <LINK REL="stylesheet" HREF="../../../Active.css" TYPE="text/css">
- <LINK REV="made" HREF="mailto:">
- </HEAD>
-
- <BODY>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> Tk::Error - Method invoked to process background errors</P></STRONG>
- </TD></TR>
- </TABLE>
-
- <A NAME="__index__"></A>
- <!-- INDEX BEGIN -->
-
- <UL>
-
- <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
-
- <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
- <LI><A HREF="#description">DESCRIPTION</A></LI>
- <LI><A HREF="#bugs">BUGS</A></LI>
- <LI><A HREF="#see also">SEE ALSO</A></LI>
- <LI><A HREF="#keywords">KEYWORDS</A></LI>
- </UL>
- <!-- INDEX END -->
-
- <HR>
- <P>
- <H1><A NAME="name">NAME</A></H1>
- <P>Tk::Error - Method invoked to process background errors</P>
- <P>
- <HR>
- <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
- <UL>
- <LI>Linux</LI>
- <LI>Solaris</LI>
- <LI>Windows</LI>
- </UL>
- <HR>
- <H1><A NAME="synopsis">SYNOPSIS</A></H1>
- <P>Customization:</P>
- <PRE>
- require Tk::ErrorDialog;</PRE>
- <P>or</P>
- <PRE>
- sub Tk::Error
- {
- my ($widget,$error,@locations) = @_;
- ...</PRE>
- <PRE>
- }</PRE>
- <P>
- <HR>
- <H1><A NAME="description">DESCRIPTION</A></H1>
- <P>The <STRONG>Tk::Error</STRONG> method is invoked by perl/Tk when a background
- error occurs. Two possible implementations are provided in the
- distribution and individual applications or users can (re)define a <STRONG>Tk::Error</STRONG>
- method (e.g. as a perl sub) if they wish to handle background
- errors in some other manner.</P>
- <P>A background error is one that occurs in a command that didn't
- originate with the application. For example, if an error occurs
- while executing a <A HREF="../../../site/lib/Tk/callbacks.html">callback</A> specified with a
- <A HREF="../../../site/lib/Tk/bind.html">bind</A> or a <A HREF="../../../Tk/after.html">after</A>
- command, then it is a background error. For a non-background error,
- the error can simply be returned up through nested subroutines
- until it reaches the top-level code in the application;
- then the application can report the error in whatever way it
- wishes. When a background error occurs, the unwinding ends in
- the Tk library and there is no obvious way for Tk to report
- the error.</P>
- <P>When Tk detects a background error, it saves information about the
- error and invokes the <STRONG>Tk::Error</STRONG> method later when Tk is idle.</P>
- <P><STRONG>Tk::Error</STRONG> is invoked by perl/Tk as if by the perl code:</P>
- <P> <EM>$mainwindow</EM>-><STRONG>Tk::Error</STRONG>(<EM>``error message''</EM>, <EM>location ...</EM>);</P>
- <P><EM>$mainwindow</EM> is the <STRONG>MainWindow</STRONG> associated with widget which
- detected the error, <EM>``error message''</EM> is a string describing the error
- that has been detected, <EM>location</EM> is a list of one or more ``locations''
- which describe the call sequence at the point the error was detected.</P>
- <P>The locations are a typically a mixture of perl location reports giving
- script name and line number, and simple strings describing locations in
- core Tk or perl/Tk C code.</P>
- <P>Tk will ignore any result returned by the <STRONG>Tk::Error</STRONG> method.
- If another error occurs within the <STRONG>Tk::Error</STRONG> method
- (for example if it calls <STRONG>die</STRONG>) then Tk reports this error
- itself by writing a message to stderr (this is to avoid infinite loops
- due to any bugs in <STRONG>Tk::Error</STRONG>).</P>
- <P>If several background errors accumulate before <STRONG>Tk::Error</STRONG>
- is invoked to process them, <STRONG>Tk::Error</STRONG> will be invoked once
- for each error, in the order they occurred.
- However, if <STRONG>Tk::Error</STRONG> calls <STRONG>Tk->break</STRONG>, then
- any remaining errors are skipped without calling <STRONG>Tk::Error</STRONG>.</P>
- <P>The <STRONG>Tk</STRONG> module includes a default <STRONG>Tk::Error</STRONG> subroutine
- that simply reports the error on stderr.</P>
- <P>An alternate definition is provided via :</P>
- <P> <CODE>require Tk::ErrorDialog;</CODE></P>
- <P>that posts a dialog box containing the error message and offers
- the user a chance to see a stack trace showing where the
- error occurred.</P>
- <P>
- <HR>
- <H1><A NAME="bugs">BUGS</A></H1>
- <P>If <STRONG>after</STRONG> or <STRONG>fileevent</STRONG> are not invoked as methods of a widget
- then perl/Tk is unable to provide a <EM>$mainwindow</EM> argument.
- To support such code from earlier versions of perl/Tk
- perl/Tk therefore calls <STRONG>Tk::Error</STRONG> with string 'Tk' instead:
- <STRONG>Tk->Tk::Error\(...\)</STRONG>.
- In this case the <STRONG>Tk::Error</STRONG> in <STRONG>Tk::ErrorDialog</STRONG> and similar
- implementations cannot ``popup'' a window as they don't know which display
- to use. A mechanism to supply <EM>the</EM> <STRONG>MainWindow</STRONG> in applications
- which only have one (a very common case) should be provided.</P>
- <P>
- <HR>
- <H1><A NAME="see also">SEE ALSO</A></H1>
- <P><A HREF="../../../site/lib/Tk/bind.html">Tk::bind</A>
- <A HREF="../../../Tk/after.html">Tk::after</A>
- <A HREF="../../../site/lib/Tk/fileevent.html">Tk::fileevent</A></P>
- <P>
- <HR>
- <H1><A NAME="keywords">KEYWORDS</A></H1>
- <P>background error, reporting</P>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> Tk::Error - Method invoked to process background errors</P></STRONG>
- </TD></TR>
- </TABLE>
-
- </BODY>
-
- </HTML>
-