[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cgiapp
Subject:    [cgiapp] BUGFIX: t/forward.t - problem with HTML::FillInForm >= 1.07
From:       "Joshua Miller" <unrtst () gmail ! com>
Date:       2007-09-23 9:15:26
Message-ID: 1b9c12d0709230215x768c3320pc6c3a1e3eb4395e () mail ! gmail ! com
[Download RAW message or body]


"make test" on CGI::Application::Plugin::ValidatorRM was failing on
t/forward.t.
    t/forward........NOK 2
    #   Failed test 'form is returned'
    #   in t/forward.t at line 22.
    #          got: 'legacy form output HUH'
    #     expected: 'legacy form output'
    t/forward........NOK 4
    #   Failed test 'form is returned'
    #   in t/forward.t at line 56.
    #          got: 'forward form output
HUH'                                       #     expected: 'forward form
output'
    # Looks like you failed 2 tests of 4.
    t/forward........dubious
            Test returned status 2 (wstat 512, 0x200)
    DIED. FAILED tests 2, 4
            Failed 2/4 tests, 50.00% okay

I searched, and found an existing recent problem report with the
same error, but no fix:

http://www.mail-archive.com/cgiapp@lists.erlbaum.net/msg06154.html
Subject: Re: Problem installing the CGI::Application::Pliugin::Session and
ValidateRM


The problem is that the t/forward.t test has a workaround in it for a bug
in HTML::FillInForm <= 1.06. The FillInForm bug can be seen with the
following:

    use HTML::FillInForm;
    my $src ="one two three";
    my $res = HTML::FillInForm->new->fill( scalarref => \$src );
    print "[$src][$res]\n";

Which results in "[one two three][one two]" under FillInForm 1.06.
This doesn't normally cause a problem, because templates and files generally
end in a newline character, which will get chomped, but won't be missed
by anyone.


FillInForm >= 1.07 fixed this by changing the last part of sub fill to
include "$self->eof;":
    # diff -c HTML-FillInForm-1.0[67]/lib/HTML/FillInForm.pm
    *** 89,94 ****
    --- 95,102 ----
            $self->parse($_);
          }
        }
    +
    +   $self->eof;
        return delete $self->{output};
      }



Here's a patch for t/forward.t to make it compatable with both the old
and new HTML::FillInForm.
------BEGIN PATCH------
--- t/forward.t 2007-09-23 04:40:13.000000000 -0400
+++ t/forward_new.t     2007-09-23 04:55:26.000000000 -0400
@@ -12,7 +12,8 @@
     sub legacy_form { my $self = shift;
         Test::More::is($self->get_current_runmode, 'legacy_process', "if
             ::Forward is not loaded, current_rm is not updated");
-        $self->header_type('none'); return "legacy form output HUH"; }
+        $self->header_type('none');
+        return ($HTML::FillInForm::VERSION <= 1.06) ? "legacy form output
HUH" : "legacy form output"; }

     sub legacy_process { my $self = shift; my ($results, $err_page) =
         $self->check_rm('legacy_form', { required => 'fail' }); return
@@ -42,7 +43,7 @@
         Test::More::is($self->get_current_runmode, 'forward_form',
             "if ::Forward is loaded, current_rm is updated");
         $self->header_type('none');
-        return "forward form output HUH";
+        return ($HTML::FillInForm::VERSION <= 1.06) ? "forward form output
HUH" : "forward form output";
     }

     sub forward_process {
------END PATCH------

Thanks,
--
Josh I.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic