NAME

Top Close Open

Template:TT3::Element::Literal - base class element for literal elements

DESCRIPTION

Top Close Open

This module implements a subclass of Template::TT3::Element to represent literal tokens. It acts as a common base class for the Template::TT3::Element::Text , Template::TT3::Element::Word , Template::TT3::Element::Keyword and various other modules.

METHODS

Top Close Open

This module implements the following methods in addition to those inherited from the Template::TT3::Element , Template::TT3::Base and Badger::Base base classes.

parse_word()

Top Close Open

This method is an alias to the advance() method inherited from the Template::TT3::Element base class.

parse_expr()

Top Close Open

This method is an alias to the advance() method inherited from the Template::TT3::Element base class.

text()

Top Close Open

This method simply returns the literal token text.

value()

Top Close Open

An alias to the text() method.

values()

Top Close Open

An alias to the text() method.

variable()

Top Close Open

Returns a Template::TT3::Variable object to represent the text. The variable object can be used to call dotop methods against the literal value.

source()

Top Close Open

Returns a canonical representation of the template source expression for this element. It uses the sprintf() format returned by the SOURCE_FORMAT constant method to render the literal text. In this base class the SOURCE_FORMAT is defined to be %s, resulting in a simple pass-through of the token text. Subclasses may redefine SOURCE_FORMAT to render a different representation of the element.

CONSTANTS

Top Close Open

This module defines the following constant. Note that constants are implemented in Perl as subroutines that can be called as methods against an object.

my $format = $self->SOURCE_FORMAT;

This allows a subclass to re-define the SOURCE_FORMAT constant method to return a different value.

SOURCE_FORMAT

Top Close Open

This returns a sprintf() string for the source() method to use. In this base class it returns %s. Subclasses may redefine it to return a different format.

AUTHOR

Top Close Open

Andy Wardley http://wardley.org

COPYRIGHT

Top Close Open

Copyright (C) 1996-2009 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

Top Close Open

This module inherits methods from the Template::TT3::Element , Template::TT3::Base and Badger::Base base classes.

It is constructed using the Template::TT3::Class::Element class metaprogramming module.

It is itself the base class for the Template::TT3::Element::Text , Template::TT3::Element::Number , Template::TT3::Element::Word , Template::TT3::Element::Keyword and Template::TT3::Element::Filename modules.


http://tt3.template-toolkit.org/docs/Template/TT3/Element/Literal.pm last modified 2009-12-21 15:34:09