From: Mischa POSLAWSKY Date: Sun, 19 Oct 2008 14:47:33 +0000 (+0000) Subject: do not alter option hash ref in check() X-Git-Url: http://git.shiar.net/perl/html-form-simple.git/commitdiff_plain/0e9c7322ba3c935e9d81f28e321297816af90f2f do not alter option hash ref in check() Method check could set at least 'checked' attribute in given rows. Passes test 53 (options var unmodified). --- diff --git a/lib/HTML/Form/Simple.pm b/lib/HTML/Form/Simple.pm index 440f404..152efe9 100644 --- a/lib/HTML/Form/Simple.pm +++ b/lib/HTML/Form/Simple.pm @@ -202,7 +202,7 @@ sub check { my ($name, $label, $checked, $attr) = $self->_attr(3, @_); my $rows = defined $label ? ref $label eq 'ARRAY' ? [@$label] : [$label] : [{}]; - ref $_ eq 'HASH' or $_ = {label => $_} for @$rows; + $_ = ref $_ eq 'HASH' ? {%$_} : {label => $_} for @$rows; if (defined $checked) { if (ref $checked eq 'ARRAY') { $rows->[$_]->{checked} = $checked->[$_] for 0 .. $#$rows;