Skip Menu |
 

This queue is for tickets about the File-Comments CPAN distribution.

Report information
The Basics
Id: 63788
Status: resolved
Priority: 0/
Queue: File-Comments

People
Owner: Nobody in particular
Requestors: paul [...] city-fan.org
Cc:
AdminCc:

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

Attachments


Subject: [PATCH] Test suite fails with HTML::Element 4.x
Download (untitled) / with headers
text/plain 521b
In HTML::Element 4.x, the as_HTML method no longer appends a newline to the HTML it returns (RT #41739). The 005HTML.t test expects the newline to be there and the test fails as a result. The attached patch changes the strip_html_comments routine to remove a trailing newline if present, resulting in the same behaviour for both old and new versions of HTML::Element, and the 005HTML.t test is adjusted not to expect a trailing newline any more. The test suite subsequently works for HTML::Element versions 3.x and 4.x.
Subject: File-Comments-0.07-strip-newline.patch
diff -up File-Comments-0.07/lib/File/Comments/Plugin/HTML.pm.orig File-Comments-0.07/lib/File/Comments/Plugin/HTML.pm --- File-Comments-0.07/lib/File/Comments/Plugin/HTML.pm.orig 2005-05-01 21:24:40.000000000 +0100 +++ File-Comments-0.07/lib/File/Comments/Plugin/HTML.pm 2010-12-09 22:02:10.231271719 +0000 @@ -86,7 +86,11 @@ sub strip_html_comments { WARN "Cannot parse $target->{path}"; return $target->{content}; } - return $root->as_HTML(); + my $stripped_html = $root->as_HTML(); + # HTML::Element < 4 appends a newline to the HTML + # for no apparent reason (CPAN RT#41739) + $stripped_html =~ s/\n$//; + return $stripped_html; } 1; diff -up File-Comments-0.07/t/005HTML.t.orig File-Comments-0.07/t/005HTML.t --- File-Comments-0.07/t/005HTML.t.orig 2005-05-01 21:24:25.000000000 +0100 +++ File-Comments-0.07/t/005HTML.t 2010-12-09 21:56:31.754475742 +0000 @@ -37,5 +37,5 @@ is($chunks->[1], "another comment", "HTM is($chunks->[2], "and yet another\n<A>", "HTML comment"); my $stripped = $snoop->stripped($tmpfile); -is($stripped, qq{<html><head></head><body><a href="foo">def</a><center> </center><b></b></body> </html>\n}, "stripped HTML comments"); +is($stripped, qq{<html><head></head><body><a href="foo">def</a><center> </center><b></b></body> </html>}, "stripped HTML comments");
Download (untitled) / with headers
text/plain 178b
Applied: https://github.com/mschilli/file-comments-perl/commit/7ff00b00a4194ef4ee9547d40baba53887393b93 ... and released as 0.08. Thanks for your contribution! -- Mike


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.