X-Git-Url: http://git.shiar.net/perl/html-form-simple.git/blobdiff_plain/6bef855dc6c753640512d512e5b31e2734484382..635b2ce8c382e7515adc8232064caa689cdee0c9:/lib/HTML/Form/Simple.pm diff --git a/lib/HTML/Form/Simple.pm b/lib/HTML/Form/Simple.pm index 5946030..730c41b 100644 --- a/lib/HTML/Form/Simple.pm +++ b/lib/HTML/Form/Simple.pm @@ -71,6 +71,16 @@ sub hidden { my $self = shift; my ($name, $value, $attr) = $self->_attr(2, @_); + if (ref $name eq 'HASH') { + my @return = map { $self->hidden($_, $name->{$_}, $attr) } sort keys %$name; + return wantarray ? @return : join(defined $, ? $, : '', @return); + } + + if (ref $value eq 'ARRAY') { + my @return = map { $self->hidden($name, $_, $attr) } @$value; + return wantarray ? @return : join(defined $, ? $, : '', @return); + } + $attr->{name } = $name if defined $name; $attr->{value} = $value if defined $value; $attr->{type} = 'hidden' unless defined $attr->{type}; @@ -200,7 +210,7 @@ sub check { =head1 NAME -HTML::Form::Simple +HTML::Form::Simple - Generate HTML form elements =head1 SYNOPSIS @@ -225,3 +235,12 @@ HTML::Form::Simple ); say $input->stop; # +=head1 AUTHOR + +Mischa POSLAWSKY + +=head1 LICENSE + +This module is free software; you can redistribute it and/or modify it +under the same L as Perl itself. +