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 one-liners


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

icecreamboyy


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."

You may first need to cpan XML::API::XHTML, and install Tidy using your favorite package manager, or just download Tidy by itself

If you can't install XML::API::XHTML

On my system, CPAN complained that "make test had returned bad status" during installation of XML::API::XHTML. To solve this I started the CPAN shell (just type cpan) and then forced the install, like this:

cpan> force XML::API::XHTML
  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.