| 1 | #!/usr/bin/perl5.8.0 | ||
| 2 | |||
| 3 | |||
| 4 | use strict; | ||
| 5 | use XML::Template; | ||
| 6 | use XML::Template::Config; | ||
| 7 | use XML::Template::Element::File::Load; | ||
| 8 | use XML::Template::Element::Block::Load; | ||
| 9 | |||
| 10 | |||
| 11 | my $path = $ENV{PATH_INFO} || 'index.xhtml'; | ||
| 12 | $path =~ s[^/][]; | ||
| 13 | |||
| 14 | my $xmlt = XML::Template->new ( | ||
| 15 | Load => [ | ||
| 16 | XML::Template::Element::File::Load->new ( | ||
| 17 | IncludePath => ['.', XML::Template::Config->admindir]), | ||
| 18 | XML::Template::Element::Block::Load->new ( | ||
| 19 | StripPattern => '\/?([^\/]+)\..*$') | ||
| 20 | ], | ||
| 21 | ErrorTemplate => 'error.xhtml') | ||
| 22 | || XML::Template->handle_error ('Template', XML::Template->error ()); | ||
| 23 | $xmlt->process ($path) | ||
| 24 | || print "Error: " . $xmlt->error () . "\n"; |