|
#!/usr/bin/env perl
our ( $mydir , $myname );
BEGIN {
my $location = (-l $0) ? abs_path($0) : $0;
$location =~ /(.*?)([^\/]+?)_?\z/s or die "?" ;
( $mydir , $myname ) = ($1, $2);
}
$| = 1;
sub countdown {
my ( $i ) = @_ ;
lazyLight {
if ( $i >= 0) {
cons(P( $i ), countdown( $i - 1));
} else {
null
}
}
}
sub page {
my ( $title , $mtime , $main ) = @_ ;
HTML(
HEAD(TITLE( $title )),
BODY(
$main ,
HR(),
P(
"By " ,
", last modified at " ,
gmtime ( $mtime ) . "" ,
" (or something)."
)
)
)
}
our $numbers = { 1 => "one" , 2 => "two" , 3 => "three" };
sub examplepage {
my ( $title ) = @_ ;
page(
"example page - $title" ,
$ENV {T} // time ,
[
H1( $title ),
P(
"Garçon méchanique, \"1 < 2\" is true. " ,
A({ href => "\"1 < 2\"" }, "this will be 404" )
),
TABLE(
{ border => 1 },
map { TR(TD( $_ ), TD( $$numbers { $_ })) } (1 .. 3)
),
countdown( $ENV {N} || 1e9),
]
)
}
pxml_xhtml_print examplepage( "Hello World" ), *STDOUT {IO}, "en" ;
|