HTML::Template::Plugin::Dot is nearing 1.0!
In the past few days, I've made numerous improvements and bugfixes. The most notable of those is loop support: anything returning an array (or reference to one) can be used in a tmpl_loop:
use HTML::Template::Pluggable;
use HTML::Template::Plugin::Dot;
use My::Feed; # a Class::DBI object
my $tmpl = q{
Feed: <tmpl_var feed.name> at <tmpl_var feed.url>
Items:<tmpl_loop feed.items:item>
"<tmpl_var item.title>" by <tmpl_var item.author> (<tmpl_var item.postdate.dmy>)
</tmpl_loop>
};
my $t = HTML::Template::Pluggable->new( scalarref => \$tmpl );
my $feed = My::Feed->retrieve(1);
$t->param( feed => $feed );
print $t->output;
Notice how we only pass in the $feed object, and make use of its relationships to display its items. The ':item' suffix works similar to foreach my $item( $feed->items ). I even provide the equivalent of $_ as an implicit local variable, but I've chosen to name it "this", since that's what web designers would be more familiar with than a bare underscore
The other big improvement is that HTML::Template::Pluggable and
The last bit of big news is that CromeDome has released a plugin for CGI::Application that makes the drop-in even smoother! All you need to do is make a small change to your base class, adding CGI::Application::Plugin::HTDot to its @ISA. All your existing code will keep working as before, but the new dot power is available everywhere, ready for you to tap into.
I'm quite thrilled about my progress, and about CromeDome's plugin
I'm now at a stage where I can go try out all this new power and flexibility. I'm going to see about benchmarking as well; maybe there are performance issues I do not know about yet. But at least it's stable, and that's the important part.
more progress on HTML::Template::Plugin::Dot 0 Comments More | Login | Reply /