http://www.perlmonks.org?node_id=474345


in reply to Re: How to get the output from make test into a text file? (HTML-Element-Library)
in thread How to get the output from make test into a text file? (HTML-Element-Library)

I figured out why I am having problems, and a fix.

What I haven't figured out is, why am I having problems, but the tests pass on CPAN, as you say. I am guessing that this has to do with a dependency: File::Slurp, or HTML::Element, or one of those. I wonder, is there any way I can determine what versions of the dependency modules the CPAN tester had? At any rate, the problem I was having is that some of your tests generate files, which then get read back in with File::Slurp.

For whatever reason, when they were getting read back in, there was an extra line break coming in as well. I have noticed this problem before; I believe it has to do with inconsitent line breaks between windows (\x0d\x0a, aka form feed then line break) and unix. The end effect is that I, every now and then, wind up with strings of \x0d\x0d\x0d\x0a, ie, too many repeated form feed before the final line breaks.

Yuck fu.

But anyway, the fix is to change:

#snip of highlander.t my $generated_html = ptree($tree, "$root.gen"); is ($generated_html, File::Slurp::read_file("$root.exp"), "HTML for +$age");
to
my $generated_html = ptree($tree, "$root.gen"); my $file = File::Slurp::read_file("$root.exp"); $file =~ s/\x0d+\x0a/ /g; is ($generated_html, $file, "HTML for $age");
Ugly as hell, but it got all highlander.t tests to pass.

I didn't fix any other tests, but if you would like me to, I wouldn't mind delving deeper into this.

The other tests that failed were iter.t, table-alt.t, table.t, and unroll-select.t.

Thanks again for putting together a great module.