|
|
|
|
|
by pflanze
3775 days ago
|
|
I'm going a tiny step further with the XML/HTML generation solution in functional Perl [1]: provide actual functions to instantiate HTML (or defined XML) elements, instead of relying on arrays. That allows for passing them directly to higher-order functions like map (and it also gives elements a proper type). my $rows= list(list(1,2,3), list(4,5,6));
HTML(BODY(TABLE($rows->map(fun($row) { TR($row->map(*TD)) }))))->string
# => '<html><body><table><tr><td>1</td><td>2</td><td>3</td></tr><tr><td>4</td><td>5</td><td>6</td></tr></table></body></html>'
ref HTML()
# => 'PXML::PXHTML';
[1] http://functional-perl.org/ |
|