sub quote {
my $self = shift;
+ return ${$_[0]} if ref $_[0] eq 'SCALAR';
return XML::Quote::xml_quote_min($_[0]);
}
# strip empty if it shouldn't be
defined $attr->{$_} and $attr->{$_} eq '' and delete $attr->{$_}
- for qw(id type class style);
+ for qw(id for type class style);
my $return = '<' . $tag;
$self->select($name, $rows, {%$attr, type => 'checkbox'});
}
+sub row {
+ my $self = shift;
+ my ($name, $contents, $attr) = $self->_attr(2, @_);
+
+ $contents = defined $contents && ref $contents ne 'HASH'
+ ? $self->quote($contents) : $self->text($name, $contents);
+ my $label = defined $attr->{label}
+ ? $self->quote(delete $attr->{label})
+ : defined $name ? $self->quote($name) : '';
+
+ return $self->tag(label => {for => $name, %$attr})
+ . $label
+ . '</label>'
+ . (defined $, ? $, : ' ')
+ . $contents
+ ;
+}
+
1;
__END__