/[wopi2]/trunk/lib/WOPI.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/WOPI.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1 by dpavlin, Wed Jun 23 11:56:27 2004 UTC revision 4 by dpavlin, Fri Jun 25 11:46:24 2004 UTC
# Line 35  sub new { Line 35  sub new {
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;
# Line 53  sub get_html { Line 53  sub get_html {
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    
# Line 69  sub editor { Line 86  sub editor {
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    
# Line 82  sub save_question { Line 101  sub save_question {
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    
# Line 94  sub save_question { Line 113  sub save_question {
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    

Legend:
Removed from v.1  
changed lines
  Added in v.4

  ViewVC Help
Powered by ViewVC 1.1.26