Skip Menu |

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

Report information
The Basics
Id: 62725
Status: rejected
Priority: 0/
Queue: HTML-Tree

People
Owner: Nobody in particular
Requestors: jason [...] long.name
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in:
  • 3.23
  • 4.1
Fixed in: (no value)



Subject: Parser ignores last word if input string does not end with \n
The following script use HTML::TreeBuilder; my $html = HTML::TreeBuilder->new(); $html->parse("1 2 3"); print $html->as_HTML; outputs <html><head></head><body>1 2</body></html> which is wrong, in my opinion. It should be <html><head></head><body>1 2 3</body></html> I have found that adding a \n to the input string will prevent this problem from occurring.
Ah, never mind, I think I figured it out. I'm using it wrong. With parse() you have to use eof() to signal the end of file.
On Fri Nov 05 09:30:50 2010, JASLONG wrote: Show quoted text
> Ah, never mind, I think I figured it out. I'm using it wrong. > > With parse() you have to use eof() to signal the end of file.
That's right. The parser holds on to the "3" until either more chars to parse or eof follows. The parser promise not to break up "words" reported to its text callbacks.