From 0e9c7322ba3c935e9d81f28e321297816af90f2f Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sun, 19 Oct 2008 14:47:33 +0000 Subject: [PATCH] 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). --- lib/HTML/Form/Simple.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.30.0