in reply to Generation of dynamically-static documents

i don't know if this will do what you want, i hacked together a quick and dirty script...
Generate static pages "at will" (e.g., via cron job, or just when I run the command).
set $offline to 1 in the script, then it will generate the runmode html file with every click on your local webserver.
the only requirement is that you don't have the links in the templates but give them to the template module as objects $foo = "rm=foo";bless(\$foo, "Static::Link");
you might add a spider script that automatically calls every runmode like that.
the script probably runs also with HTML::Template if you adjust the tmpl_vars.
package Static::Link; use strict; use warnings; use vars '$type'; $type = 'cgi'; # default use overload '""' => sub { $_[0]->$type }; # '/cgi-bin/static.pl' => # http://server.example/cgi-bin/static.pl?rm=foo my $script = "/cgi-bin/static.cgi"; # 'html/' => # http://server.example/html/rm_foo.html my $htdocs = ""; sub cgi { "$script?".${$_[0]} } sub offline { my $link = ${$_[0]}; $link =~ tr/=/_/; # fit to your needs "$htdocs$link.html"; }
the script:
use strict; use warnings; use CGI; use HTML::Template::Compiled 0.43; my $offline = 1; # set to 1 if on development server my $q = CGI->new; print $q->header; my $dir = '/www/cgi-bin/static'; my $rm = $q->param("rm")||"foo"; my $htc = HTML::Template::Compiled->new( path => $dir, scalarref => \<<EOM, <h2>we are at runmode <tmpl_var .runmode></h2> <a href="<tmpl_var .rm.foo>">foo</a> <a href="<tmpl_var .rm.bar>">bar</a> EOM # optional # cache_dir => "$dir/cache", ); my $foo = "rm=foo"; my $bar = "rm=bar"; my %p = ( runmode => $rm, rm => { foo => bless(\$foo, "Static::Link"), bar => bless(\$bar, "Static::Link"), }, ); $htc->param(%p); print $htc->output; if ($offline) { # generate static page $Static::Link::type = 'offline'; my $link = $p{rm}->{$rm}; my $file = "$link"; open my $fh, ">./static/htdocs/$file" or die $!; print $fh $htc->output; # update: set to cgi again $Static::Link::type = 'cgi'; }