The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
[%#
  # IMPORTANT NOTE
  #   This documentation is generated automatically from source
  #   templates.  Any changes you make here may be lost.
  # 
  #   The 'docsrc' documentation source bundle is available for download
  #   from http://www.template-toolkit.org/docs.html and contains all
  #   the source templates, XML files, scripts, etc., from which the
  #   documentation for the Template Toolkit is built.
-%]
[% META book = 'Modules'
        page = 'Exception'
%]
[%  WRAPPER toc;
	PROCESS tocitem 
	        title ="SYNOPSIS"
                subs  = [];
	PROCESS tocitem 
	        title ="DESCRIPTION"
                subs  = [];
	PROCESS tocitem 
	        title ="AUTHOR"
                subs  = [];
	PROCESS tocitem 
	        title ="VERSION"
                subs  = [];
	PROCESS tocitem 
	        title ="COPYRIGHT"
                subs  = [];
	PROCESS tocitem 
	        title ="SEE ALSO"
                subs  = [];
    END
%]
<!-- Pod to HTML conversion by the Template Toolkit version 2 -->
[% WRAPPER section
    title="SYNOPSIS"
-%]<pre>    use Template::Exception;</pre>
<pre>    my $exception = Template::Exception-&gt;new($type, $info);
    $type = $exception-&gt;type;
    $info = $exception-&gt;info;
    ($type, $info) = $exception-&gt;type_info;</pre>
<pre>    print $exception-&gt;as_string();</pre>
<pre>    $handler = $exception-&gt;select_handler(\@candidates);</pre>
[%- END %]
[% WRAPPER section
    title="DESCRIPTION"
-%]<p>
The Template::Exception module defines an object class for
representing exceptions within the template processing life cycle.
Exceptions can be raised by modules within the Template Toolkit, or
can be generated and returned by user code bound to template
variables.
</p>
<p>
Exceptions can be raised in a template using the THROW directive,
</p>
<pre>    [% tt_start_tag %] THROW user.login 'no user id: please login' [% tt_end_tag %]</pre>
<p>
or by calling the throw() method on the current Template::Context object,
</p>
<pre>    $context-&gt;throw('user.passwd', 'Incorrect Password');
    $context-&gt;throw('Incorrect Password');    # type 'undef'</pre>
<p>
or from Perl code by calling die() with a Template::Exception object,
</p>
<pre>    die (Template::Exception-&gt;new('user.denied', 'Invalid User ID'));</pre>
<p>
or by simply calling die() with an error string.  This is
automagically caught and converted to an  exception of 'undef'
type which can then be handled in the usual way.
</p>
<pre>    die &quot;I'm sorry Dave, I can't do that&quot;;</pre>
<p>
Each exception is defined by its type and a information component
(e.g. error message).  The type can be any identifying string and may
contain dotted components (e.g. 'foo', 'foo.bar', 'foo.bar.baz').
Exception types are considered to be hierarchical such that 'foo.bar'
would be a specific type of the more general 'foo' type.
</p>
[%- END %]
[% WRAPPER section
    title="AUTHOR"
-%]<p>
Andy Wardley &lt;abw@wardley.org&gt;
</p>
<p>
[% ttlink('http://wardley.org/', 'http://wardley.org/') -%]
</p>
[%- END %]
[% WRAPPER section
    title="VERSION"
-%]<p>
2.69, distributed as part of the
Template Toolkit version 2.19, released on 27 April 2007.
</p>
[%- END %]
[% WRAPPER section
    title="COPYRIGHT"
-%]<pre>  Copyright (C) 1996-2007 Andy Wardley.  All Rights Reserved.</pre>
<p>
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
</p>
[%- END %]
[% WRAPPER section
    title="SEE ALSO"
-%]<p>
[% ttlink('Template', 'Template') -%], [% ttlink('Template::Context', 'Template::Context') -%]
</p>
[%- END %]