package Template::Declare::TagSet; use strict; use warnings; use base qw(Class::Accessor::Fast); __PACKAGE__->mk_ro_accessors( qw{ namespace package } ); sub get_alternate_spelling { undef; } sub get_tag_list { []; } # specify whether "" can be combined to "" sub can_combine_empty_tags { 1; } 1; __END__ =head1 NAME Template::Declare::TagSet - Base class for tag sets used by Template::Declare::Tags =head1 SYNOPSIS 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 "" can be # combined to "": sub can_combine_empty_tags { my ($self, $tag) = @_; $tag =~ /^ (?: base | meta | link | hr ) $/x; } =head1 DESCRIPTION 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 L for a useful example. =head1 METHODS =head2 new( PARAMS ) my $tag_set = Template::Declare::TagSet->new({ package => 'Foo::Bar', namespace => undef, }); Constructor created by C, accepting an optional hash reference of parameters. =head2 get_tag_list my $list = $tag_set->get_tag_list(); Returns an array ref for the tag names offered by a tag set. =head2 get_alternate_spelling( TAG ) $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 C tag in HTML conflicts with Perl's C operator, and the C