You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by darren chamberlain <da...@boston.com> on 2000/07/12 18:28:33 UTC

HTML::Stream (was Re: Hang in $r->print w/ POST)

heddy Boubaker (boubaker@cena.fr) said something to this effect:
>  What I meant is a pkg that could generate all known HTML tags, not like
>  HTML::StickyForms ... 
>  
>  But all of you guys changed my mind instead of hardcoding the html into my
>  handler I'll try to investigate the use of templates files (I've too many
>  choices over there). BTW the handler I'm currently writing could be of
>  general interest, I'll try to release it to the public community one day so
>  you'll all critisize it (or legalize it) ;-)

I recently started looking at the HTML:Stream package, and it looks pretty
interesting. Synopsis:

use HTML::Stream;

my $r = shift;
my $HTML = HTML::Stream($r); # Pass in an object with a print method
                             # or a GLOB ref, e.g., \*STDOUT

$HTML->A(HREF=>$r->uri)
      ->text('I am a link to the current page')
      ->_A;

The only thing(s) I don't like about it are that it calls print on its own,
rather than returning strings, but that is easily fixed. I do like the C++-ish
method of method chaining. The main problem with it, though, is that it won't
plug into existing CGI code, since it calls print on its own. If I decide
to use that, I will modify the file, and probably send a patch to the author.

(darren)

-- 
When all you have is a hammer, everything looks like a nail. When all
you have is inheritance, everything looks like a hierarchy.

Re: HTML::Stream (was Re: Hang in $r->print w/ POST)

Posted by heddy Boubaker <bo...@cena.fr>.
 <> "Darren" == darren chamberlain <da...@boston.com> writes:

 Darren> I recently started looking at the HTML:Stream package, and it looks
 Darren> pretty interesting. 

 Yes it seems interesting but I'll definitivefy try to switch to templates,
 BTW the new CGI("") approach Bruce noticed seems to be an interesting one
 too, maybe by subclassing CGI pkg ?
 
 Darren> The only thing(s) I don't like about it are that it calls print on
 Darren> its own, rather than returning strings, but that is easily fixed.

 Yes by using: 
 use HTML::Stream qw(:funcs);

 print html_tag('A', HREF=>$link);
 print html_escape("<<Hello & welcome!>>");

 But this is not what I'll call a complete html generator as it do not know
 html tags by itself.
 
 Too many choices with all that wild perl modules ;-) that's good thing! 
 
 But I really suggest that the pb w/ CGI eating the post data be clearly
 reported in the mod_perl Guide and FAQ.
 
 regards
 
-- 
 /   From the last station before the end of the neT   \
 \ Centre d'Etudes de la Navigation Aerienne,  div SSS /
 / 7, av edouard Belin - 31055 Toulouse CEDEX - France \
 \ Tel:(+33|0)5.62.25.95.22 | Fax:(+33|0)5.62.25.95.99 /