We Recommend

Learning Perl Learning Perl
In this smooth, carefully paced course, a leading Perl trainer teaches you to program in the language that threatens to make C, sed, awk, and the Unix shell obsolete for many tasks. This book is the "official" guide for both formal (classroom) and informal learning. It is fully accessible to the novice programmer.


Posted By

noah on 02/10/08


Tagged

template html xhtml generator code commandline engine module perl howto markup cygwin oo tidy automation cpan w3


Versions (?)


Generate XHTML on the command line with XML::API::XHTML


Published in: Perl 


URL: http://search.cpan.org/~mlawren/XML-API-0.18/lib/XML/API/XHTML.pm

Build a simple XHTML document, format it with Tidy and print the result to "temp.html."

  1. perl -e "use XML::API::XHTML; my $d = new XML::API::XHTML(); $d->head_open(); $d->title('hello world!'); $d->script({type => 'text/javascript'}, '/* hello scripts! */'); $d->head_close(); $d->body_open(); $d->h1({style => 'color:red'}, 'Hi nerd!'); print $d;" | tidy -q -o temp.html

Report this snippet 

You need to login to post a comment.