blib/lib/Mojolicious/Plugin/Text/Caml.pm

filter: Statementstmt 90.9% 20 / 22 Branchbran 62.5% 5 / 8 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 81.5% 31 / 38 SCAR 18.3
CC
6
Cov
81%
__ANON__
5.6
register
2.1
BEGIN
1.0
CRAP 6.2
↑ Summary Build »
1 package Mojolicious::Plugin::Text::Caml;
2 1 ▶use Mojo::Base 'Mojolicious::Plugin';
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 1 ▶use Text::Caml;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 our $VERSION = '0.03';
7  
8 sub register {
9 1 ▶ my ($self, $app, $args) = @_;
Subroutine register: called CC=2 SCAR=7.2
Pod documented
10  
11 1 ▶ $args //= {};
Condition50%1/2
$args //= {}
l!l
10
MC/DC0%0/1
$args //= {}
$args
Truth table50%1/2
A
A= $args
Aresult
11
00
12 1 my $caml = Text::Caml->new(%$args);
13  
14 $app->renderer->add_handler(caml => sub {
15 2 ▶ my ($renderer, $c, $output, $options) = @_;
Subroutine __ANON__: called CC=5 SCAR=17.3
16  
17 2 ▶ if ($options->{inline}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($options->{'inline'}) { } 1 1 2
elsif (my $template_name = $renderer->template_path($options)) { } 0 1 1
18 1 my $inline_template = $options->{inline};
19 1 $$output = $caml->render($inline_template, $c->stash);
20 }
21 elsif (my $template_name = $renderer->template_path($options)) {
22 0 $caml->set_templates_path($renderer->paths->[0]);
23 0 $$output = $caml->render_file($template_name, $c->stash);
24 } else {
25 1 my $data_template = $renderer->get_data_template($options);
26 1 ▶ $$output = $caml->render($data_template, $c->stash) if $data_template;
Branch: 1 branch
BranchTrueFalseTotal
if $data_template 1 0 1
27 }
28 2 ▶ return $$output ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$$output ? : 2 0 2
29 1 });
30  
31 1 return 1;
32 }
33  
34 1 1;
35 __END__
↑ Summary Build »