blib/lib/Mojolicious/Plugin/ViewBuilder.pm

filter: Statementstmt 100% 19 / 19 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 96.4% 27 / 28 CC 4 SCAR 10.0
CC
4
Cov
96%
__ANON__
4.0
register
1.0
BEGIN
1.0
CRAP 2.7
↑ Summary
1 package Mojolicious::Plugin::ViewBuilder;
2 2 our $VERSION = "0.06";
3  
4 2 ▶use Mojo::Base 'Mojolicious::Plugin';
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶sub register {
Subroutine register: called CC=1 SCAR=0.0
Pod documented
7 1 my ( $self, $app, $conf ) = @_;
8 1 push @{ $app->renderer->classes }, __PACKAGE__;
9  
10 $app->helper(
11 2 ▶ add_view => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
12 2 shift;
13 2 push( @{ $app->{views}->{ +shift() } }, shift );
14 }
15 1 );
16  
17 $app->helper(
18 2 ▶ pluggable_view => sub {
Subroutine __ANON__: called CC=4 SCAR=13.9
19 2 my $c=shift;
20 2 ▶ die "No view defined" unless defined $_[0];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_[0] 0 2 2
21 2 my $output;
22 $output .= ref $_ eq 'CODE' ? $_->( $c, $app,@_ ) : $app->$_($c,@_)
23 2 ▶ for ( @{ $app->{views}->{ +shift() } } );
Branch: 1 branch
BranchTrueFalseTotal
ref $_ eq 'CODE' ? : 2 2 4
24 2 return $output;
25 }
26 1 );
27  
28 }
29  
30 2 1;
31  
32 __END__
↑ Summary