Skip Menu |
 

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

Report information
The Basics
Id: 43361
Status: open
Priority: 0/
Queue: PPI-HTML

People
Owner: Nobody in particular
Requestors: sergej.klimenok [...] sealsystems.de
Cc:
AdminCc:

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



Subject: Internet Explorer can not handle very long HTML lines
Download (untitled) / with headers
text/plain 712b
There is a bug in Fragment.pm of the PPI::HTML perl module, which occurs using Internet Explorer. If the HTML output to generate is especially large, the code in line 94 of Fragment.pm generates a very long HTML line. Internet Explorer can not handle HTML lines this long, throws an error and can not load the webpage. My operating environment consists of: - PPI-HTML-1.07 - perl v5.8.8 - Internet Explorer 7 - Windows XP Professional Version 2002 Service Pack 2 I am sending my draft proposal of Fragment.pm for the next PPI::HTML version as attachment. A newline in line 94 splits the very long line for the Internet Explorer. The newline in line 83 is meant to prevent HTML Tidy warnings in Mozilla Firefox.
Sorry. I have forgotten to attach the patch.
Download Fragment.pm
text/x-perl 1.9k
package PPI::HTML::Fragment; # A HTML fragment object is a small object that contains a string due to # become HTML content, and a simple rule for it's display, such as a class # name. use strict; use vars qw{$VERSION}; BEGIN { $VERSION = '1.07'; } ##################################################################### # Constructor and Accessors sub new { my $class = ref $_[0] ? ref shift : shift; my $string = defined $_[0] ? shift : return undef; my $css = shift or return undef; # Create the basic object my $self = bless { string => $string, css => $css, }, $class; $self; } sub string { $_[0]->{string} } sub css { $_[0]->{css} } ##################################################################### # Main Methods # Does the segment end with a newline? sub ends_line { $_[0]->string =~ /\n$/ } # Render to HTML sub html { my $self = shift; my $html = $self->_escape( $self->string ); return $html unless $self->css; $self->_tagpair( 'span', { class => $self->css }, $html ); } sub concat { my $self = shift; my $string = defined $_[0] ? shift : return undef; $self->{string} .= $string; 1; } sub clear { my $self = shift; delete $self->{css}; 1; } ##################################################################### # Support Methods # Embedding some HTML stuff until I find a suitably lightweight dependency sub _escape { my $html = defined $_[1] ? "$_[1]" : return ''; $html =~ s/&/&amp;/g; $html =~ s/</&lt;/g; $html =~ s/>/&gt;/g; $html =~ s/\"/&quot;/g; $html =~ s/(\015{1,2}\012|\015|\012)/<br\/>\n/g; $html; } sub _tagpair { my $class = shift; my $tag = shift or return undef; my %attr = ref $_[0] eq 'HASH' ? %{shift()} : (); my $start = join( ' ', $tag, map { defined $attr{$_} ? qq($_="$attr{$_}") : "$_" } sort keys %attr ); "<$start>" . join('', @_) . "</$tag>\n"; } 1;


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.