]> sipb.mit.edu Git - ikiwiki.git/blob - doc/bugs/formbuilder_3.0401_broken.mdwn
solution?
[ikiwiki.git] / doc / bugs / formbuilder_3.0401_broken.mdwn
1 After editing ikiwiki.setup, and running "ikiwiki --setup", the CGI script is successfully created.  However, if I then click on "Edit Page" link, I see nothing in the browser and the following in the logs:
2
3 <pre>
4 ==> /var/log/apache2/access_log <==
5 192.168.0.125 - - [06/Oct/2006:15:12:05 -0500] "GET /cgi-bin/ikiwiki.cgi?page=index&do=edit HTTP/1.1" 500 666
6
7 ==> /var/log/apache2/error_log <==
8 [Fri Oct 06 15:12:07 2006] [error] [client 192.168.0.125] HTML::Template::param() : attempt to set parameter 'form-submit' with an array ref - parameter is not a TMPL_LOOP! at /usr/lib/perl5/site_perl/5.8/CGI/FormBuilder.pm line 1415, referer: http://imrisws36/wiki/
9 [Fri Oct 06 15:12:07 2006] [error] [client 192.168.0.125] Premature end of script headers: ikiwiki.cgi, referer: http://imrisws36/wiki/
10 </pre>
11
12 Can anyone decipher this for me?  I spent some time with cpan earlier today downloading the latest version I could find of prerequisite modules such as HTML::Template and CGI::FormBuilder.
13
14 > It would help to know what version of CGI::FormBuilder you have. Mine
15 > (3.03.01) does not seem to contain this error message. --[[Joey]]
16
17 I have version 3.0401 of CGI::FormBuilder -- the latest from CPAN.  If you are wondering about any other modules, the answer 
18 is likely the same: the latest from CPAN.  And you're right: the error string in question does not appear in CGI::FormBuilder.  I found it in HTML::Template (version 2.8).
19
20 -----
21
22 OK, so downgrading CGI::FormBuilder to 3.0302 makes the problem go away.  I'll leave it to you to figure out whether the bug is in CGI::FormBuilder or in IkiWiki. --Steve
23
24 Maybee this bug should be renamed as "doesn't work with CGI::FormBuilder (3.04)." I get same error on FreeBSD.  
25
26     HTML::Template::param() : attempt to set parameter 'form-submit' with an array 
27     ref - parameter is not a TMPL_LOOP! 
28     at /usr/local/lib/perl5/site_perl/5.8.7/CGI/FormBuilder.pm line 1415
29
30 version info:
31
32     root@freedom# pkg_info | grep p5-CGI
33     p5-CGI-FastTemplate-1.09 Perl module for manage templates and parses templates
34     p5-CGI-FormBuilder-3.0401 FormBuilder for CGI
35     p5-CGI-Session-4.14 Perl extension for persistent session management
36
37 --Mark
38
39 ----
40
41 For the curious, this new version of CGI::FormBuilder changes how it passes
42 some values to the HTML::Template template. In particular, FORM-SUBMIT used
43 to be just a string containing the buttons used to submit the form. With
44 the new version, it's an array of strings, one per button, and the template
45 needs to be written differently to deal with this. Oddly, the docs have not
46 been updated about this. In fact, from all I can tell, it's a bug, since
47 the array is not in the form that HTML::Template expects to receive it. 
48 Here's a simple test case:
49
50         #!/usr/bin/perl
51         my @fields=qw(editcontent);
52         my @buttons=("Save", "Preview", "Cancel");
53
54         use CGI::FormBuilder;
55         my $form = CGI::FormBuilder->new(
56                 fields => \@fields,
57                 template => "foo.tmpl",
58         );
59         print $form->render(submit => \@buttons);
60
61 With this test case, it does not seem to be possible to write a foo.tmpl that
62 outputs the buttons using the FORM-SUBMIT template variable.
63
64 I was able to work around this bug by just not using FORM-SUBMIT in the
65 template, and hardcoding the buttons (since they never change anyway).
66 Nasty, but it should work. I haven't fully installed the new version of
67 CGI::FormBuilder to test it, and it's quite possible that other changes
68 in the new version cause other breakage. If you want to test the fix,
69 it's in svn now. --[[Joey]]
70
71 Now that the new version of formbuilder is in debian unstable, I'm using
72 ikiwiki with it, and, after fixing a bug or two more, I think it's all
73 working, so I'll call this bug [[bugs/done]]. --[[Joey]]