This looks very good... looking forward to seeing it on CPAN.
A quick question... is it easy to make it use different template file extension (.tt, .tt2, tt3, .html) and use a different INCLUDE_PATH. These options make it very easy to then sit on top of current production systems.
BTW.. as previously mentioned.. I think u should use a different default extension to "*.t"... perhaps .tt or .tt2?
/I3az/ Ian Sillitoe wrote:
This is a follow up on a previous thread ("Moose::Role::TTSelf"). With peregrin's help (and considerable patience - many thanks) - I think MooseX::Templated is pretty much at the point of pushing to CPAN. I'm forwarding this to this list in case anyone has any more comments/suggestions before I tip it over the edge (synopsis appended below) http://code2.0beta.co.uk/moose/svn/MooseX-Templated/ Cheers, Ian =head1 NAME MooseX::Templated::Role - Framework to render Moose objects with templates =head1 SYNOPSIS Farm/Cow.pm package Farm::Cow; use Moose; with 'MooseX::Templated::Role'; has 'spots' => ( is => 'rw' ); has 'hobbies' => ( is => 'rw', default => sub { ['mooing', 'chewing'] } ); sub moo { "Moooooooo!" } Farm/Cow.t This cow has [% self.spots %] spots. It mostly spends its time [% self.hobbies.join(" and ") %]. However, when it is very happy it exclaims, "[% self.moo %]!". Elsewhere on the Farm... my $cow = Farm::Cow->new( spots => '8' ); $cow->render(); # This cow has 8 spots. It mostly spends its time # mooing and chewing. However, when it is very happy # it exclaims, "Moooooooo!". Alternatively, back in the cowshed package Farm::Cow; <snip> sub _templated_xml { return <<"_XML_TT"; <cow sound="[% self.moo | html %]" spots="[% self.spots %]"> [%- FOREACH hobby = self.hobbies %] <hobby name="[% hobby | html %]"/> [%- END %] </cow> _XML_TT } Back out on the farm $cow->render( 'xml' ); # <cow sound="Moooooooo" spots="8"> # <hobby name="mooing"/> # <hobby name="chewing"/> # </cow>