--- trunk/lib/WOPI.pm 2004/06/23 11:56:27 1 +++ trunk/lib/WOPI.pm 2004/06/25 11:46:24 4 @@ -35,7 +35,7 @@ $self->{'poll'} = $self->{'db'}->get($self->{'poll_name'}); } -print $self->{'cgi'}->header, Dumper($self->{'db'}); +#print $self->{'cgi'}->header, Dumper($self->{'db'}); if ($self->{'poll'} && defined($self->{'poll'}->{'questions'})) { $self->{'order'} = (scalar @{$self->{'poll'}->{'questions'}})+1; @@ -53,12 +53,29 @@ my $html; $self->{'tt'}->process($template, $param, \$html) || - die $self->{'tt'}->error(); + confess $self->{'tt'}->error(); return $html; } # +# Acme methods +# + +sub unbless { + my $self = shift; + + my $var = Dumper(\@_); + + while ($var =~ s/bless\(\s*([{\[].*?[}\]])\s*,\s*'DBM::Deep'\s*\)/$1/sg) { }; + my $VAR1; + eval $var; + warn("eval of $var failed: $@") if ($@); + + return (wantarray ? @{$VAR1} : shift @{$VAR1}); +} + +# # CGI methods # @@ -69,6 +86,8 @@ $self->{'param'}->{'poll_name'} = $self->{'poll_name'}; $self->{'param'}->{'order'} = $self->{'order'}; + $self->{'param'}->{'poll'} = $self->unbless($self->{'poll'}); + return $self->get_html('editor.html', $self->{'param'}); } @@ -82,7 +101,7 @@ my %v = map { $_ => $self->{'param'}->{$_} } qw(poll_name order); - print "v = ",Dumper(\%v); +# print "v = ",Dumper(\%v); my $o = $self->{'cgi'}->param('order') || die "no order?"; @@ -94,7 +113,7 @@ 'order' => $o || die, }; -print "question = ",Dumper($question); +#print "question = ",Dumper($question); push @{$self->{'poll'}->{'questions'}}, $question;