template toolkit ordinals

template toolkit ordinals
Did Template Toolkit ordinals from scratch. Here’s how to drop it in with Lingua::EN::Numbers::Ordinate. Relevant lines are in bold.
use warnings;
use strict;
use CGI qw( header start_html );
use Template;
use Lingua::EN::Numbers::Ordinate 'ordinate';
my %Config = ( FILTERS => { ordinal => sub { ordinate($_[0]) } } );
my $tt2 = Template->new(\%Config);
print header(), start_html(-title => 'Ordinals');
$tt2->process(\*DATA, { bingo => [ 0 .. 121 ] }) or warn $Template::ERROR;
__DATA__ <h1>Ordinals</h1> [% FOR i IN bingo %] [% i | ordinal %] [% END %]
[close] Permanent link · http://querylog.com/q/template+toolkit+ordinals

Suggested HTML for linking:
Link preview: template toolkit ordinals
25 July 2005 · Internet & computing
The page found by the original query:
Code snippets in Perl and JavaScript
Browse by the page—15 Q&R each
« previous | more »