NAME
HTML::Parser::Simple::Attributes
- a simple HTML attribute parser
Synopsis
my $a_parser = HTML::Parser::Simple::Attributes->new(' height="20" width="20"');
# All the attributes as a hashref
my $attr_href = $a_parser->get_attr();
# A specific value.
my $val = $self->get_attr('value');
Methods
get_attr()
my $attrs_ref = $self->get_attr;
my $val = $self->get_attr('value');
If you have a start tag, this will return a hash ref with the attribute names as keys and the values as the values.
If you pass in an attribute name, it will return the value for just that attribute.
parse_attributes
$attr_href = $self->parse_attributes($attr_string);
$attr_href = HTML::Parser::Simple::Attributes->parse_attributes($attr_string);
Parses a string of HTML attributes and returns the result as a hash ref, or dies if the string is a valid attribute string. Attribute values may be quoted with double quotes, single quotes, no quotes if there are no spaces in the value.
May also be called as a class method.
Author
HTML::Parser::Simple::Attributes
was written by Mark Stosberg <mark@summersault.com> in 2009.
Home page: http://mark.stosberg.com/
Copyright
Copyright (c) 2009 Mark Stosberg.
All Programs of mine are 'OSI Certified Open Source Software';
you can redistribute them and/or modify them under the terms of
The Artistic License, a copy of which is available at:
http://www.opensource.org/licenses/index.html