I have written a class with the following properties:
That way you can write:
HTML::Element::Whatever->new('input')->name("hallo")->value("welt")->size(10)
and you get the HTML source for the appropriate input element.
This allows for some really concise generation of HTML.
*adds that to mental list of things to make...*my $table = SQL::Translator::Schema::Table->new('mytable');
$table->column('id')->type('var char')->size('36')->default('foo');
Re:By the way..
malte on 2005-08-08T13:10:58
I will eventually. Its only in internal use now where we don't need it passing the whole HTML element test suite.
Do you have a name suggestion?
Re:By the way..
jk2addict on 2005-08-08T13:25:40
How about HTML::Element::Chained? I also thought of HTML::Element::Recursive. That sounds better, but my be misleading.
To be honest, I don’t think that’s particularly a good interface. Passing a hashref for attributes is both more obvious as well as more concise, syntax-wise.
I’m also never sure whether to like method chaining in general or not. It’s a kludge for Perl5; fortunately we won’t need it in Perl6.