| 1 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 2 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | package MojoX::Renderer::Alloy::HTE; | ||||||||||||||||||||||||||||||||||||||||||
| 4 | 3 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 3 | $MojoX::Renderer::Alloy::HTE::AUTHORITY = 'cpan:AJGB'; | |||||||||||||||||||||||||||||||||||||||||
| 6 | } | ||||||||||||||||||||||||||||||||||||||||||
| 7 | { | ||||||||||||||||||||||||||||||||||||||||||
| 8 | 3 | $MojoX::Renderer::Alloy::HTE::VERSION = '1.121150'; | |||||||||||||||||||||||||||||||||||||||||
| 9 | } | ||||||||||||||||||||||||||||||||||||||||||
| 10 | #ABSTRACT: Template::Alloy's HTML::Template::Expr renderer | ||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 3 | ▶ | use base 'MojoX::Renderer::Alloy'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 3 | ▶ | use Template::Alloy qw( HTE ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 3 | ▶ | use File::Spec (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | 3 | __PACKAGE__->attr('_hte_config'); | |||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | ▶ | sub _init { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_init: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | my %config = $self->_default_config(@_); | |||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | $config{path} = $config{INCLUDE_PATH} | ||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | unless exists $config{path}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | $self->_hte_config( \%config ); | |||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | sub _render { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_render: not called CC=9 SCAR=45.0
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | my ($self, $r, $c, $output, $options) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | my $inline = $options->{inline}; | |||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | my $tname = $r->template_name($options); | |||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | my $path = $r->template_path($options); | |||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | ▶ | return unless defined $inline || ( defined $path && defined $tname ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $inline or defined $path and defined $tname
defined $path and defined $tname
MC/DC0%0/3
defined $inline or defined $path and defined $tname
defined $inline
defined $path
defined $tname
Truth table0%0/4
A or B and C
A= defined $inlineB= defined $pathC= defined $tname
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | my $alloy; | |||||||||||||||||||||||||||||||||||||||||
| 43 | # inline | ||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | if ( defined $inline ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | $alloy = Template::Alloy->new( | ||||||||||||||||||||||||||||||||||||||||||
| 46 | type => 'scalarref', | ||||||||||||||||||||||||||||||||||||||||||
| 47 | source => \$inline, | ||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | %{ $self->_hte_config }, | |||||||||||||||||||||||||||||||||||||||||
| 49 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||
| 51 | # regular file | ||||||||||||||||||||||||||||||||||||||||||
| 52 | elsif ( -r $path ) { | ||||||||||||||||||||||||||||||||||||||||||
| 53 | $alloy = Template::Alloy->new( | ||||||||||||||||||||||||||||||||||||||||||
| 54 | type => 'filename', | ||||||||||||||||||||||||||||||||||||||||||
| 55 | source => $path, | ||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | %{ $self->_hte_config }, | |||||||||||||||||||||||||||||||||||||||||
| 57 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||
| 59 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 60 | # inlined templates are not supported | ||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | if ( $r->get_data_template($options, $tname) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | $c->render_exception( | |||||||||||||||||||||||||||||||||||||||||
| 63 | "Inlined templates are not supported" | ||||||||||||||||||||||||||||||||||||||||||
| 64 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 65 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | $c->render_not_found( $tname ); | |||||||||||||||||||||||||||||||||||||||||
| 67 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | $alloy->param( | |||||||||||||||||||||||||||||||||||||||||
| 72 | $self->_template_vars( $c ) | ||||||||||||||||||||||||||||||||||||||||||
| 73 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | $$output = $alloy->output(); | |||||||||||||||||||||||||||||||||||||||||
| 77 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | if ( my $e = $alloy->error || $@ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$alloy->error || $@
MC/DC0%0/2
$alloy->error || $@
$alloy->error
$@
Truth table0%0/3
A || B
A= $alloy->errorB= $@
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | chomp $e; | |||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | $c->render_exception( $e ); | |||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 83 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | __END__ | ||||||||||||||||||||||||||||||||||||||||||