From 7d639e01d4b63644343db6b550ec84211e73f167 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 12 Dec 2006 10:43:05 +0000 Subject: [PATCH] save_form() und restore_form() koennen jetzt auch mit Arrays umgehen, die in $form gespeichert sind. --- bin/mozilla/common.pl | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/bin/mozilla/common.pl b/bin/mozilla/common.pl index 4ca0b8a0c..67b9e076f 100644 --- a/bin/mozilla/common.pl +++ b/bin/mozilla/common.pl @@ -16,9 +16,14 @@ use SL::Common; sub save_form { $lxdebug->enter_sub(); - my $old_form = ""; - map({ $old_form .= "$_=" . $form->escape($form->{$_}) . '&'; } keys(%{$form})); - chop($old_form); + my (@names, @values); + foreach my $key (keys(%{$form})) { + push(@names, "\$form->{\"$key\"}"); + push(@values, $form->{$key}); + } + my $dumper = Data::Dumper->new(\@values, \@names); + $dumper->Indent(0); + my $old_form = $dumper->Dump(); $lxdebug->leave_sub(); @@ -28,14 +33,10 @@ sub save_form { sub restore_form { $lxdebug->enter_sub(); - my ($old_form) = @_; - - map({ delete($form->{$_}); } keys(%{$form})); + my ($old_form, $no_delete) = @_; - foreach my $pair (split('&', $old_form)) { - my ($key, $value) = split('=', $form->unescape($pair), 2); - $form->{$key} = $value; - } + map({ delete($form->{$_}); } keys(%{$form})) unless ($no_delete); + eval($old_form); $lxdebug->leave_sub(); } -- 2.20.1