NAME

Top Close Open

Template:TT3::Element::String - base class element representing strings

DESCRIPTION

Top Close Open

This module implements a subclass of Template::TT3::Element to represent quoted text strings. It acts as a common base class for the Template::TT3::Element::Squote and Template::TT3::Element::Dquote elements used to represent 'single' and "double" quoted strings, respectively.

METHODS

Top Close Open

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

parse_expr($token,$scope,$precedence)

Top Close Open

This method is called to parse a string as an expression.

parse_filename($token,$scope,$precedence)

Top Close Open

This method is called to parse a string as a filename. It is defined as an alias to parse_expr() .

text($context)

Top Close Open

This method returns the content of the quote string (i.e. not including the quote marks) stored in the EXPR slot. Subclasses may redefine this method to perform additional processing of the string content (e.g. double quoted strings which may have embedded variable references).

value($context)

Top Close Open

An alias to the text() method.

values($context)

Top Close Open

An alias to the text() method.

filename($context)

Top Close Open

This method is a thin wrapper around the text() method. It is called when a quoted string is used as a filename.

template($context)

Top Close Open

This method fetches the template from the the $context object passed as an argument, using its own text() value as the identifier.

variable()

Top Close Open

This method returns the string content (as returned by the text() method) as a variable object.

view($view)

Top Close Open

This method is called by a Template::TT3::View object as part of the double dispatch process that is used to render views of template elements. It calls the view_string() method against the view object passed as the only argument, $view. It passes itself as an argument to the view_string() method.

CONSTANTS

Top Close Open

The following constant method is defined:

SOURCE_FORMAT

Top Close Open

This defines a sprintf() format string of "%s" (note that the quotes are part of the format). This is used by the source() method inherited from Template::TT3::Element::Literal to render a canonical representation of the template source code for this element.

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::Text , Template::TT3::Element::Literal , 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::Padding and Template::TT3::Element::String modules.


http://tt3.template-toolkit.org/docs/Template/TT3/Element/String.pm last modified 2009-12-21 12:42:43