#!/usr/bin/perl use HTMLObject::Template; my $doc = HTMLObject::Template->new(file => "/var/www/templates/index.html"); $doc->setTitle("Test of HTMLObject::Template"); $doc->printTag(tag => "", value => <<"END_OF_BODY");

HTMLObject::Template


This is cool!
Everything in red was just dynamically stuck in this template!
END_OF_BODY #$doc->setJavascriptVersion("1.6"); $doc->printJavascriptRequired(); #$doc->setFocus("dummy"); my $text = $doc->readTag(tag => ""); $doc->deleteTag(tag => ""); $doc->printTag(tag => "", value => "I just added some more text and flipped things around via read and delete!
$text"); #$doc->substitute(tag => "", value => $bodyDoc); $doc->setCookie(name => 'cookie name', value => 'This rocks!'); $doc->javascriptPrint(<<"END_JAVASCRIPT"); function helloWorld() { window.alert("Hello World"); } END_JAVASCRIPT # cause the helloWorld function to be called when the page has been # loaded! $doc->setOnload(code => "helloWorld();"); $doc->onbeforeunload("return 'testing the onbeforeunload support in your browser.';"); # make the link change the background when you go over it. my %attributes = ( background => "yellow" ); $doc->setStyleEntry( tag => "a:hover", attributes => \%attributes ); $doc->setLinkDecorations; # Actually generate the entire document, cookie and all! $doc->display();