Skip Menu |

This queue is for tickets about the HTML-FillInForm CPAN distribution.

Report information
The Basics
Id: 21750
Status: resolved
Priority: 0/
Queue: HTML-FillInForm

People
Owner: Nobody in particular
Requestors: MIYAGAWA [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: [Patch] Fix a bug the last plaintext part might be chopped if called via scalarref
This module doesn't call eof() when it deals with scalarref and arrayref, which causes a bug that the last plaintext might be cut off of the result. Here's a patch and a regression test to verify. == lib/HTML/FillInForm.pm ================================================================== --- lib/HTML/FillInForm.pm (revision 5460) +++ lib/HTML/FillInForm.pm (local) @@ -89,6 +89,8 @@ $self->parse($_); } } + + $self->eof; return delete $self->{output}; } === t/20_scalarref.t ================================================================== --- t/20_scalarref.t (revision 5460) +++ t/20_scalarref.t (local) @@ -0,0 +1,27 @@ +use strict; +use warnings; +use Test::More; +use HTML::FillInForm; + +# a few strings to test against +my @contents = ( + q{404}, + q{404 Not Found}, + q{Hello World}, + q{<html><body>Hello World</body></html>}, +); + +# our number of tests in the number of elements in @contents +plan tests => (scalar @contents); + + +# run each string through H::FIF +foreach my $content (@contents) { + my $output = HTML::FillInForm->new->fill( + scalarref => \$content, + fdat => {} + ); + + is($output, $content, q{output and content should be the same}); +} +
On Wed Sep 27 12:47:14 2006, MIYAGAWA wrote: Show quoted text
> This module doesn't call eof() when it deals with scalarref and > arrayref, which causes a bug that the last plaintext might be cut off > of the result. Here's a patch and a regression test to verify.
Nice one! I've been seeing this problem for some time but unable to locate the cause. Now it just needs applying to the module :-/