Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Best Perl Module for creating multiple web pages with different information in them?

by tobyink (Abbot)
on Feb 19, 2013 at 17:17 UTC ( #1019625=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1019625]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2018-02-25 06:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (312 votes). Check out past polls.

    Notices?