Jeremy Wall > Bricklayer-Templater-0.9.8 > Bricklayer::Templater::Handler

Download:
Bricklayer-Templater-0.9.8.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

Bricklayer::Templater::Handler - Base class for all Template tag handlers

SYNOPSIS ^

DESCRIPTION ^

Bricklayer::Templater::Handler does all the common heavy lifting that a Template tag handler needs to do. It initialize the handler object and sets up the callback hooks that are needed.

The Handler API.

Handler object attributes

app
    $self->app() returns the template engine
attributes
    $self->attributes() returns a hashref of tag attributes. tag attributes are specified the same way
    that xml attributes are with the following restrictions.
attribute values must be enclosed in double quotes
block
    $self->block() returns the text block contents of the tag. The bricklayer parser is not recursive
    on its own. If you tag is expected to process the block as more template text then you should call
    parse_block() as shown below.
type
    $self->type() returns the tag type. This shoule be either 'block' or 'single' or 'text'. You
    probably will never need to use this.
tagname
    $self->tagname() returns the tag's name. This should be the classname minus the 
    Bricklayer::Templater::Handler:: part.
tagid
    $self->tagid() returns the template engines current template tag identifier. It is equivalent to
    calling $self->app()->identifier.

handler object Methods

load
    Bricklayer::Templater::Handler::tag::name->load() is the constructor for a tag handler.
    it will get passed a Token data structure and the Template engine object as a context.
parse_block
    $self->parse_block($arg) is a convenience function that will run the templater on the block with
    any argument you pass in to it.
run_handler
    $handler->run_handler() is what the engine calls to actually run the handler. You probably
    shouldn't be using this method since it's mostly for internal use.
syntax highlighting: