no newlines in as_HTML?

Fred Douglis (douglis@research.att.com)
Mon, 15 Jul 1996 10:30:52 -0400


Something else that has changed from b5 to 5.0 (without any particular mention 
in the ChangeLog from what I can tell) is the lack of newlines in generated 
HTML.  Seems like the library used to insert newlines in any constructs that 
weren't configured not to insert them.  Now it just builds a list of elements 
and joins them with the null separator followed by one newline at the end.

Normally HTML is insensitive to the lack of newlines, but when parsing and 
regenerating a large document, missing newlines can be annoying. In fact, I 
used to use "GET -o html file:..." to pretty-print a file that had poor 
structure and turn it into something that was nicely indented.  I really miss 
that -- is there a way to do that still?

Anyway, my temporary fix was to change the join construct in as_HTML to join 
with newlines, but I'm not sure that's guaranteed to work.  Gisle, any 
thoughts?  Speaking of changing as_HTML, let me ask an aside about O-O 
techniques to handle this.  I'm a relative neophyte at O-O programming and 
certainly with respect to Perl5.  I have successfully subclassed some of the 
packages to give them different behavior that I want in a particular 
application, but I'm wondering about cases like this where I'd expect to 
replace a piece of as_HTML across the board.  I don't want to modify every 
script to use a new class in place of HTML.  If I don't want to touch the 
original library, is it sufficient to redefine it directly, as in:

require HTML::Element;
{
    package HTML::Element;
    
    sub as_HTML
	{
	# ... new version goes here
	}
}

Thanks,

Fred Douglis 		    MIME accepted	  douglis@research.att.com
AT&T Research					  908 582-3633 (office)
600 Mountain Ave., Rm. 2B-105 			  908 582-3063 (fax)
Murray Hill, NJ 07974     http://www.research.att.com/orgs/ssr/people/douglis/