Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

template::exception(3pm) [debian man page]

Template::Exception(3pm)				User Contributed Perl Documentation				  Template::Exception(3pm)

NAME
Template::Exception - Exception handling class module SYNOPSIS
use Template::Exception; my $exception = Template::Exception->new($type, $info); $type = $exception->type; $info = $exception->info; ($type, $info) = $exception->type_info; print $exception->as_string(); $handler = $exception->select_handler(@candidates); DESCRIPTION
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. Exceptions can be raised in a template using the "THROW" directive, [% THROW user.login 'no user id: please login' %] or by calling the throw() method on the current Template::Context object, $context->throw('user.passwd', 'Incorrect Password'); $context->throw('Incorrect Password'); # type 'undef' or from Perl code by calling "die()" with a "Template::Exception" object, die (Template::Exception->new('user.denied', 'Invalid User ID')); or by simply calling "die()" with an error string. This is automagically caught and converted to an exception of '"undef"' type (that's the literal string '"undef"' rather than Perl's undefined value) which can then be handled in the usual way. die "I'm sorry Dave, I can't do that"; 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. METHODS
type() Returns the exception type. info() Returns the exception information. AUTHOR
Andy Wardley <abw@wardley.org> <http://wardley.org/> COPYRIGHT
Copyright (C) 1996-2007 Andy Wardley. All Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
Template, Template::Context perl v5.14.2 2011-12-20 Template::Exception(3pm)

Check Out this Related Man Page

Template::Stash::XS(3)					User Contributed Perl Documentation				    Template::Stash::XS(3)

NAME
Template::Stash::XS - High-speed variable stash written in C SYNOPSIS
use Template; use Template::Stash::XS; my $stash = Template::Stash::XS->new(\%vars); my $tt2 = Template->new({ STASH => $stash }); DESCRIPTION
The Template:Stash::XS module is an implementation of the Template::Stash written in C. The "XS" in the name refers to Perl's XS extension system for interfacing Perl to C code. It works just like the regular Perl implementation of Template::Stash but runs about twice as fast. The easiest way to use the XS stash is to configure the Template Toolkit to use it by default. You can do this at installation time (when you run "perl Makefile.PL") by answering 'y' to the questions: Do you want to build the XS Stash module? y Do you want to use the XS Stash by default? y See the INSTALL file distributed with the Template Toolkit for further details on installation. If you don't elect to use the XS stash by default then you should use the "STASH" configuration item when you create a new Template object. This should reference an XS stash object that you have created manually. use Template; use Template::Stash::XS; my $stash = Template::Stash::XS->new(\%vars); my $tt2 = Template->new({ STASH => $stash }); Alternately, you can set the $Template::Config::STASH package variable like so: use Template; use Template::Config; $Template::Config::STASH = 'Template::Stash::XS'; my $tt2 = Template->new(); The XS stash will then be automatically used. If you want to use the XS stash by default and don't want to re-install the Template Toolkit, then you can manually modify the "Template/Config.pm" module near line 42 to read: $STASH = 'Template::Stash::XS'; BUGS
Please report bugs to the Template Toolkit mailing list templates@template-toolkit.org AUTHORS
Andy Wardley <abw@wardley.org> <http://wardley.org/> Doug Steinwand <dsteinwand@citysearch.com> COPYRIGHT
Copyright (C) 1996-2012 Andy Wardley. All Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
Template::Stash perl v5.16.3 2012-01-13 Template::Stash::XS(3)
Man Page