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
Template::Declare::TagSet(3) User Contributed Perl Documentation Template::Declare::TagSet(3)

Template::Declare::TagSet - Base class for tag sets used by Template::Declare::Tags

    package My::TagSet;
    use base 'Template::Declare::TagSet';

    # returns an array ref for the tag names
    sub get_tag_list {
        [ qw(
            html body tr td table
            base meta link hr
        )]
    }

    # prevents potential naming conflicts:
    sub get_alternate_spelling {
        my ($self, $tag) = @_;
        return 'row'  if $tag eq 'tr';
        return 'cell' if $tag eq 'td';
    }

    # Specifies whether "<tag></tag>" can be
    # combined to "<tag />":
    sub can_combine_empty_tags {
        my ($self, $tag) = @_;
        $tag =~ /^ (?: base | meta | link | hr ) $/x;
    }

Template::Declare::TagSet is the base class for declaring packages of Template::Delcare tags. If you need to create new tags for use in your templates, this is the base class for you! Review the source code of Template::Declare::TagSet::HTML for a useful example.

    my $tag_set = Template::Declare::TagSet->new({
        package   => 'Foo::Bar',
        namespace => undef,
    });

Constructor created by "Class::Accessor::Fast", accepting an optional hash reference of parameters.

    my $list = $tag_set->get_tag_list();

Returns an array ref for the tag names offered by a tag set.

    $bool = $obj->get_alternate_spelling($tag);

Returns true if a tag has an alternative spelling. Basically it provides a way to work around naming conflicts. For example, the "tr" tag in HTML conflicts with Perl's "tr" operator, and the "template" tag in XUL conflicts with the "template" sub exported by "Template::Declare::Tags".

    $bool = $obj->can_combine_empty_tags($tag);

Specifies whether "<tag></tag>" can be combined into a single token, "<tag />". By default, all tags can be combined into a single token; override in a subclass to change this value where appropriate. For example, "Template::Declare::TagSet::HTML->can_combine_empty_tags('img')" returns true since "<img src="..." />" is always required for HTML pages. "Template::Declare::TagSet::HTML->can_combine_empty_tags('script')", on the other hand, returns false, since some browsers can't handle a single script token.

This class has two read-only accessors:

    my $package = $obj->package();

Retrieves the value of the "package" option set via the constructor.

    my $namespace = $obj->namespace();

Retrieves the value of the "namespace" option set via the constructor.

Agent Zhang <agentzh@yahoo.cn>.

Template::Declare::TagSet::HTML, Template::Declare::TagSet::XUL, Template::Declare::Tags, Template::Declare.
2014-12-12 perl v5.32.1

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

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