Name
HTML::Accessors - Generate HTML elements
Version
Describes version v0.13.$Rev: 1 $ of HTML::Accessors
Synopsis
use HTML::Accessors;
my $hacc = HTML::Accessors->new();
# Create an anchor element
$anchor = $hacc->a( { href => 'http://...' }, 'This is a link' );
Description
Uses HTML::GenerateUtil to create an autoload method for each of the
elements defined by HTML::Tagset. The API was loosely taken from CGI.
Using the CGI module is undesirable in a Catalyst application (run from
the development server) due go greediness issues over STDIN.
The returned tags are either XHTML 1.1 or HTML 5 compliant.
Configuration and Environment
The constructor defines accessors and mutators for one attribute:
content_type
Defaults to application/xhtml+xml which causes the generated tags to
conform to the XHTML standard. Setting it to text/html will generate
HTML compatible tags instead
Subroutines/Methods
new
my $hacc = HTML::Accessors->new( content_type => 'application/xhtml+xml' );
Uses _hashify to process the passed options
content_type
$content_type = $hacc->content_type( $new_type );
Accessor / mutator for the content_type attribute
escape_html
my $escaped_html = $hacc->escape_html( $unescaped_html );
Expose the method escape_html
is_xml
my $bool = $hacc->is_xml;
Returns true if the returned tags will be XHTML. Matches the string
.xml at the end of the content_type
popup_menu
my $html = $hacc->popup_menu( default => $value, labels => {}, values => [] );
Returns the