... and in addition to Template::Toolkit and the other fine and dandy modules out there ... you might consider the fine and dandy language known as "perl" (aka "Perl", aka "PERL"). (Who woulda imagined it!)

Straight out of the box, you can write perl code that "cleans up" all that code you have inherited, and encourages all that great stylesheet conformity, and all that great MVC separation, and whips up a hot batch of any other buzzword-soup-of-the-day you may want to serve up.

Here is an example that is all plain perl code (with one added subroutine) that keeps our HTML template looking more like HTML than like perl (instead of the other way around).

### begin_: init perl use strict; use warnings; ### begin_: init vars my $sOut; my $oAlph = [('A' .. 'Z')]; my $oSubj = {}; $oSubj->{A} = [qw(africa asia)]; $oSubj->{B} = [qw(belgium brazil )]; my $oArti = {}; $oArti->{africa} = [qw(afone aftwo afthree )]; $oArti->{asia} = [qw(asone astwo )]; $oArti->{belgium} = [qw(beone)]; $oArti->{brazil} = [qw(brone)]; ### begin_: OutputTemplate ### ------------------ ### ------------------ $sOut .= " <html> <head></head> <body> " .sLoop($oAlph,sub{ "<a href='#'>$_</a> || " }) ."<hr /> " .sLoop([keys %{$oSubj}],sub{my $sLett=$_; "<h2>$sLett</h2> " .sLoop($oSubj->{$sLett},sub{my $sName=$_; "<h3>$sName</h3> " .sLoop($oArti->{$sName},sub{ "<h4>$_</h4> " }) }) }) . " </body> <html> " ; ### ------------------ ### ------------------ print $sOut; ### begin_: subroutines ### Simple Looping subroutine ### we use to make the perl code in our ### output template more compact sub sLoop { join"",map{$_[1]->();} (@{$_[0]}) }###end_sub ### begin_: end perl 1; __END__

which gives us something akin to ...

A || B || C || D || E || F || G || H || I || J || K || L || M || N || O || P || Q || R || S || T || U || V || W || X || Y || Z ||

A

africa

afone

aftwo

afthree

asia

asone

astwo

B

belgium

beone

brazil

brone


In reply to Re: Building html site maps by dimar
in thread Building html site maps by wfsp

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":