| 1 | package MooseX::Templated; | ||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||
| 3 | 4 | ▶ | use MooseX::Role::Parameterized; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 4 | 4 | ▶ | use MooseX::Templated::Engine; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 5 | 4 | ▶ | use MooseX::Types::Path::Class qw/ Dir /; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 6 | 4 | ▶ | use Path::Class; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 7 | 4 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||
| 9 | 3 | our $VERSION = '0.09'; | |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||
| 11 | 3 | parameter view_class => ( | |||||||||||||||||||||||||||||
| 12 | is => 'ro', | ||||||||||||||||||||||||||||||
| 13 | isa => 'Str', | ||||||||||||||||||||||||||||||
| 14 | default => 'MooseX::Templated::View::TT', | ||||||||||||||||||||||||||||||
| 15 | ); | ||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||
| 17 | 3 | parameter template_method_stub => ( | |||||||||||||||||||||||||||||
| 18 | is => 'ro', | ||||||||||||||||||||||||||||||
| 19 | isa => 'Str', | ||||||||||||||||||||||||||||||
| 20 | predicate => 'has_template_method_stub', | ||||||||||||||||||||||||||||||
| 21 | ); | ||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||
| 23 | 3 | parameter template_suffix => ( | |||||||||||||||||||||||||||||
| 24 | is => 'ro', | ||||||||||||||||||||||||||||||
| 25 | isa => 'Str', | ||||||||||||||||||||||||||||||
| 26 | predicate => 'has_template_suffix', | ||||||||||||||||||||||||||||||
| 27 | ); | ||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||
| 29 | 3 | parameter template_root => ( | |||||||||||||||||||||||||||||
| 30 | is => 'ro', | ||||||||||||||||||||||||||||||
| 31 | isa => Dir, | ||||||||||||||||||||||||||||||
| 32 | coerce => 1, | ||||||||||||||||||||||||||||||
| 33 | predicate => 'has_template_root', | ||||||||||||||||||||||||||||||
| 34 | ); | ||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||
| 36 | 3 | ▶ | role { | ||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=1.5
| |||||||||||||||||||||||||||||||
| 37 | 3 | my $p = shift; | |||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||
| 39 | 3 | has 'template_engine' => ( # class_has ? | |||||||||||||||||||||||||||||
| 40 | is => 'ro', | ||||||||||||||||||||||||||||||
| 41 | isa => 'MooseX::Templated::Engine', | ||||||||||||||||||||||||||||||
| 42 | lazy => 1, | ||||||||||||||||||||||||||||||
| 43 | builder => '_build_template_engine', | ||||||||||||||||||||||||||||||
| 44 | handles => [ 'render' ], | ||||||||||||||||||||||||||||||
| 45 | ); | ||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | method "_build_template_engine" => sub { | ||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=21.7
Subroutine
_build_template_engine: called CC=4 SCAR=21.7
| |||||||||||||||||||||||||||||||
| 48 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 49 | 0 | ▶ | my $engine = MooseX::Templated::Engine->new( | ||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||
| 50 | ( $p->has_template_method_stub ? ( template_method_stub => $p->template_method_stub ) : () ), | ||||||||||||||||||||||||||||||
| 51 | ( $p->has_template_suffix ? ( template_suffix => $p->template_suffix ) : () ), | ||||||||||||||||||||||||||||||
| 52 | ( $p->has_template_root ? ( template_root => $p->template_root ) : () ), | ||||||||||||||||||||||||||||||
| 53 | view_class => $p->view_class, | ||||||||||||||||||||||||||||||
| 54 | model => $self, | ||||||||||||||||||||||||||||||
| 55 | ); | ||||||||||||||||||||||||||||||
| 56 | 0 | return $engine; | |||||||||||||||||||||||||||||
| 57 | 3 | }; | |||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | method "render" => sub { | ||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||
| 60 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 61 | 0 | return $self->template_engine->render( @_ ); | |||||||||||||||||||||||||||||
| 62 | 3 | }; | |||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||
| 64 | 3 | }; | |||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||
| 67 | 3 | 1; | |||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||
| 69 | __END__ | ||||||||||||||||||||||||||||||