35 |
$self->{'poll'} = $self->{'db'}->get($self->{'poll_name'}); |
$self->{'poll'} = $self->{'db'}->get($self->{'poll_name'}); |
36 |
} |
} |
37 |
|
|
38 |
print $self->{'cgi'}->header, Dumper($self->{'db'}); |
#print $self->{'cgi'}->header, Dumper($self->{'db'}); |
39 |
|
|
40 |
if ($self->{'poll'} && defined($self->{'poll'}->{'questions'})) { |
if ($self->{'poll'} && defined($self->{'poll'}->{'questions'})) { |
41 |
$self->{'order'} = (scalar @{$self->{'poll'}->{'questions'}})+1; |
$self->{'order'} = (scalar @{$self->{'poll'}->{'questions'}})+1; |
53 |
|
|
54 |
my $html; |
my $html; |
55 |
$self->{'tt'}->process($template, $param, \$html) || |
$self->{'tt'}->process($template, $param, \$html) || |
56 |
die $self->{'tt'}->error(); |
confess $self->{'tt'}->error(); |
57 |
|
|
58 |
return $html; |
return $html; |
59 |
} |
} |
60 |
|
|
61 |
# |
# |
62 |
|
# Acme methods |
63 |
|
# |
64 |
|
|
65 |
|
sub unbless { |
66 |
|
my $self = shift; |
67 |
|
|
68 |
|
my $var = Dumper(\@_); |
69 |
|
|
70 |
|
while ($var =~ s/bless\(\s*([{\[].*?[}\]])\s*,\s*'DBM::Deep'\s*\)/$1/sg) { }; |
71 |
|
my $VAR1; |
72 |
|
eval $var; |
73 |
|
warn("eval of $var failed: $@") if ($@); |
74 |
|
|
75 |
|
return (wantarray ? @{$VAR1} : shift @{$VAR1}); |
76 |
|
} |
77 |
|
|
78 |
|
# |
79 |
# CGI methods |
# CGI methods |
80 |
# |
# |
81 |
|
|
86 |
$self->{'param'}->{'poll_name'} = $self->{'poll_name'}; |
$self->{'param'}->{'poll_name'} = $self->{'poll_name'}; |
87 |
$self->{'param'}->{'order'} = $self->{'order'}; |
$self->{'param'}->{'order'} = $self->{'order'}; |
88 |
|
|
89 |
|
$self->{'param'}->{'poll'} = $self->unbless($self->{'poll'}); |
90 |
|
|
91 |
return $self->get_html('editor.html', $self->{'param'}); |
return $self->get_html('editor.html', $self->{'param'}); |
92 |
} |
} |
93 |
|
|
101 |
|
|
102 |
my %v = map { $_ => $self->{'param'}->{$_} } qw(poll_name order); |
my %v = map { $_ => $self->{'param'}->{$_} } qw(poll_name order); |
103 |
|
|
104 |
print "v = ",Dumper(\%v); |
# print "v = ",Dumper(\%v); |
105 |
|
|
106 |
my $o = $self->{'cgi'}->param('order') || die "no order?"; |
my $o = $self->{'cgi'}->param('order') || die "no order?"; |
107 |
|
|
113 |
'order' => $o || die, |
'order' => $o || die, |
114 |
}; |
}; |
115 |
|
|
116 |
print "question = ",Dumper($question); |
#print "question = ",Dumper($question); |
117 |
|
|
118 |
push @{$self->{'poll'}->{'questions'}}, $question; |
push @{$self->{'poll'}->{'questions'}}, $question; |
119 |
|
|