Package: libcgi-formbuilder-perl
Version: 3.04.01-1

This new upstream version of CGI::FormBuilder is broken. I mailed the
message below to the upstream mailing list when I became aware of the
breakage, but there has been no reply. I had to work around this bug in
ikiwiki using the ugly hack described below.

(This is not the only way that this new upstream version broke ikiwiki,
but the others are harder to write good bug reports about, especially
since I'm still scrambling to fix most of them and avoid ikiwiki getting
kicked out of the etch release due to not working right anymore...)

----- Forwarded message from Joey Hess <[EMAIL PROTECTED]> -----

From: Joey Hess <[EMAIL PROTECTED]>
Date: Fri, 10 Nov 2006 15:04:42 -0500
To: [EMAIL PROTECTED]
Subject: CGI::FormBuilder 3.0401 broke FORM-SUBMIT?
User-Agent: Mutt/1.5.13 (2006-08-11)

I have a form with a customised template that contains this:

<TMPL_VAR FORM-SUBMIT>

Which is expanded to all the submit buttons in previous versions of
CGI::FormBuilder. Apparently version 3.0401 has broken this. A small
testcase:

        #!/usr/bin/perl
        my @fields=qw(editcontent);
        my @buttons=("Save", "Preview", "Cancel");

        use CGI::FormBuilder;
        my $form = CGI::FormBuilder->new(
                fields => [EMAIL PROTECTED],
                template => "foo.tmpl",
        );
        print $form->render(submit => [EMAIL PROTECTED]);

If I put the above template fragment into foo.tmpl and run this, it dies:

HTML::Template::param() : attempt to set parameter 'form-submit' with a scalar 
- parameter is not a TMPL_VAR! at /usr/share/perl5/CGI/FormBuilder.pm line 1337

Some debugging shows that CGI::FormBuilder::Template::HTML::render is doing
this:

        HTML::Template::param('undef', 'form-submit', 'ARRAY(0x847a058)') called
 at /usr/local/share/perl/5.8.4/CGI/FormBuilder/Template/HTML.pm line 155
        CGI::FormBuilder::Template::HTML::render('CGI::FormBuilder::Template::HT
ML=HASH(0x86507fc)', 'CGI::FormBuilder=HASH(0x86ca734)') called at /usr/local/sh
are/perl/5.8.4/CGI/FormBuilder.pm line 1415
        CGI::FormBuilder::render('CGI::FormBuilder=HASH(0x86ca734)', 'submit', '
ARRAY(0x847a058)') called at /usr/local/share/perl/5.8.4/IkiWiki/CGI.pm line 586
        IkiWiki::cgi_editpage('CGI=HASH(0x84579d8)', 'CGI::Session::DB_File=HASH
(0x84f1a80)') called at /usr/local/share/perl/5.8.4/IkiWiki/CGI.pm line 728
        IkiWiki::cgi() called at /usr/local/bin/ikiwiki line 107
        IkiWiki::main() called at /usr/local/bin/ikiwiki line 133

The array contains my three buttons that I passed in to the form. But
it's only valid to pass an array into HTML::Template::param if the array
contains data to set up a TMPL_LOOP .. which it doesn't. Also, the docs
don't say anything about using a TMPL_LOOP for FORM-SUBMIT.

The end result seems to be that FORM-SUBMIT is not usable at all in a
customised template with this version of CGI::FormBuilder.

-- 
see shy jo



----- End forwarded message -----
-- 
see shy jo

Attachment: signature.asc
Description: Digital signature

Reply via email to