in reply to Best Perl Module for creating multiple web pages with different information in them?

I've written a module called HTML::Inject which is designed for injection of small snippets of HTML into a template HTML file. For example

use strict; use warnings; use HTML::Inject; use HTML::HTML5::Writer; my @pages = ( [ 'greeting.en.html', 'Hello' ], [ 'greeting.fr.html', 'Bonjour' ], [ 'greeting.es.html', 'Ola' ], [ 'greeting.de.html', 'Guten Tag' ], ); my $template = HTML::Inject->new(target => <<'TEMPLATE'); <html> <div id="content"> <h1 id="heading"></h1> <div id="footer">Copyright &copy; 2013 Toby Inkster</div> </div> </html> TEMPLATE my $output = HTML::HTML5::Writer->new(polyglot => 1); for my $page (@pages) { my ($filename, $title) = @$page; my $filled_in = $template -> inject_and_new("<title>$title</title>\n") -> inject ("<h1 id='heading'>$title</h1>\n"); open my $fh, '>', $filename; print $fh $output->document($filled_in); }
package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name
pmsig
  • Comment on Re: Best Perl Module for creating multiple web pages with different information in them?
  • Download Code