Skip Menu |

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

Report information
The Basics
Id: 20797
Status: new
Priority: 0/
Queue: HTML-HTMLDoc

People
Owner: MFRANKL [...] cpan.org
Requestors: dpmott [...] sep.com
Cc:
AdminCc:

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



Subject: File mode output munged on win32, BUGFIX ATTACHED
Date: Tue, 1 Aug 2006 17:55:13 -0400 (Eastern Daylight Time)
To: bug-HTML-HTMLDoc [...] rt.cpan.org
From: "David P. Mott" <dpmott [...] sep.com>
In HTML/HTMLDoc.pm v0.10, sub generate_pdf(): The following lines do not behave properly on win32: } else { # we are in file-mode my $filename = $self->_prepare_input_file(); return undef if (!$filename); $pdf = `htmldoc $params --webpage $filename`; $self->_cleanup(); } Specifically, the value of $pdf will be corrupted with the sporatic addition of 0x0d characters. This appears to be a problem with the automatic newline conversion feature of Perl. Setting the global variable $/ does not fix this problem, despite the documentation for qx//. I've tried a number of solutions, but the only one that resulted in the correct output (without first creating a temporary file on disk) was this: } else { # we are in file-mode my $filename = $self->_prepare_input_file(); return undef if (!$filename); #$pdf = `htmldoc $params --webpage $filename`; my $fh = IO::File->new( "htmldoc $params --webpage $filename |" ); if ( $fh ) { local($/) = undef; binmode $fh; $pdf = <$fh>; close $fh; } else { warn "Failed to render PDF\n"; $pdf = ''; } $self->_cleanup(); } This fix should work on any platform. Please consider it for the next release of HTML::HTMLDoc. Thanks, dpmott@sep.com