GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  ANY::TEMPLATE::BACKEND (3)

.ds Aq ’

NAME

Any::Template::Backend - base class for implementing backends for Any::Template

CONTENTS

SYNOPSIS



        package Any::Template::Backend::MyTemplate;
       
        use MyTemplate;
        use Any::Template::Backend;
        use vars qw(@ISA);
        @ISA = qw(Any::Template::Backend);
       
        sub new {
                ...            
        }



DESCRIPTION

This exists purely to be inherited from. It provides some default implementations of sending output to different sinks based on the lowest common denominator of returning data to a string or filehandle. You can override these implementations with more efficient ones where the templating engine provides them natively.

API FOR BACKEND MODULES

$o = new Any::Template::Backend::MyBackend(\%options); You MUST supply a constructor. There is no default contructor to inherit. The constructor will need to marshal the options and create the backend template object from them. Example implementations can be found in backend classes included with the distribution.
$templating_engine = $o->native_object() Returns the underlying native template object. You SHOULD supply this method. Although accessing the underlying object defeats the point of Any::Template, a valid use is in refactoring code, where dependencies on a particular engine’s API can be eradicated in iterations.
$data = $o->preprocess($data) You CAN supply a method to preprocess the data structure before it’s handed off to one of the process methods listed below. Typically you might use this to remove some values from the data structure (e.g. globrefs) that a template backend might not be able to handle. The default implementation returns $data unmodified.
$o->process_to_string($data, $scalar_ref) You MUST supply this method. Example implementations can be found in backend classes included with the distribution.
$o->process_to_filehandle($data, $fh) You CAN supply this method. If you don’t, output will be collected in a string and sent to the filehandle.
$o->process_to_sub($data, \&code) You CAN supply this method. If you don’t, output will be collected in a string and sent to the sub.
$o->process_to_file($data, $filename) You CAN supply this method. If you don’t, a filehandle will be opened against this file, and process_to_filehandle will be used to populate it.

VERSION

$Revision: 1.8 $ on $Date: 2005/05/08 18:25:16 $ by $Author: johna $

AUTHOR

John Alden <cpan _at_ bbc _dot_ co _dot_ uk>

COPYRIGHT

(c) BBC 2005. This program is free software; you can redistribute it and/or modify it under the GNU GPL.

See the file COPYING in this distribution, or http://www.gnu.org/licenses/gpl.txt

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 ANY::TEMPLATE::BACKEND (3) 2006-05-08

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.