Which Perl web framework should I use for a static HTML application?
I am about a develop a simple web application (5-6 static pages). Is there a framework I could use for this? I can just write these HTML pages without a framework but I would like a framework as it w开发者_开发百科ill better handle header, footer, and CSS throughout the website.
I have a Perl script that will be modifying these HTML pages daily. And I don't need a database.
ttree is made for this purpose.
You can just generate the static HTML with the Perl script. That way you don't have to re-type the footer etc in each HTML file.
Used to have a page that was generated each hour with /bin/sh and various unix tools :)
edit: And, as Ignacio said, you can still use template engines etc.
For projects that are too small to use a full-fledged web framework, I usually write a class (module) for handling the layout. Then each page in the project would be a Perl script that uses the module's functions to print the header and footer. It would look something like this.
my $page = GauravWebpageClass->new(-title => 'Page Title');
$page->add_style('anotherStyle.css');
$page->add_script('fancyJavascript.js');
$page->print_header();
# Print your content here
# Print your content here
# Print your content here
$page->print_footer();
That's the basic idea. It assumes you know how to write object-oriented Perl. Let me know if you need help with the details.
Another option would be Server Side Includes.
In the past I've used a makefile that just ran various template pieces through a template engine (Genshi in my case, but the exact details don't matter) to generate the static pages.
You can try the Blueprint CSS Framework, which helps to standardize layout across different browsers.
精彩评论