| XML-Toolkit documentation | Contained in the XML-Toolkit distribution. |
XML::Toolkit::Builder::ClassTemplate - A class to ...
This documentation refers to version 0.01.
use XML::Toolkit::Builder::ClassTemplate;
The XML::Toolkit::Builder::ClassTemplate class implements ...
Parameters: none
Arguments: $_[0]
Insert description of method here...
Parameters: none
Insert description of method here...
Parameters: class
Insert description of method here...
Modules used, version dependencies, core yes/no
Moose::Role
Moose
MooseX::AttributeHelpers
...
None known currently, please email the author if you find any.
Chris Prather (perigrin@domain.tld)
Copyright 2009 by Chris Prather.
This software is free. It is licensed under the same terms as Perl itself.
| XML-Toolkit documentation | Contained in the XML-Toolkit distribution. |
package XML::Toolkit::Builder::ClassTemplate; use Moose::Role; use Template; use namespace::autoclean; with qw(XML::Toolkit::Cmd::ClassTemplate); has tt_config => ( isa => 'HashRef', is => 'ro', lazy => 1, default => sub { { OUTPUT_PATH => '.', EVAL_PERL => 1, POST_CHOMP => 1, }; }, ); has tt => ( isa => 'Template', is => 'ro', lazy_build => 1, handles => [qw(error)], ); sub _build_tt { Template->new( $_[0]->tt_config ) } sub render { return join '', map { $_[0]->render_class($_) } $_[0]->classes; } sub render_class { my ( $self, $class ) = @_; my $output; $self->tt->process( \$self->template, { meta => $class }, \$output ) || die $self->error; return $output; } 1; __END__