blib/lib/Punk/Controller.pm

filter: Statementstmt 100% 21 / 21 Branchbran 100% 2 / 2 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 100% 33 / 33 CC 3 SCAR 6.2
CC
3
Cov
100%
import
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.9
« blib/lib/Punk/Validate.pm ↑ Summary xs/serve.xs »
1 package Punk::Controller;
2  
3 21 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 21 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 21 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 21 our $VERSION = '0.70';
8  
9 # `use Punk::Controller;` is the one-line preamble: it makes the caller a
10 # controller and turns on strict and warnings, which is what `use Punk::Model`
11 # does for a model and what every controller was writing by hand. The older
12 # `use parent 'Punk::Controller'` still works and is untouched - it just does
13 # not carry the pragmas, exactly as before.
14 35 ▶sub import {
Subroutine import: called CC=3 SCAR=11.0
15 35 my ($class) = @_;
16 35 my $caller = caller;
17 # The pragmas are unconditional: they are the reason to write the one-line
18 # form, and a caller that already inherits (through `use parent`, or a
19 # second `use`) still wants them. Only the @ISA push is guarded, so it
20 # cannot be applied twice or to main.
21 35 ▶ if ( $caller ne 'main' && !$caller->isa($class) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($caller ne "main" and not $caller->isa($class)) 31 4 35
Condition100%3/3
$caller ne "main" and not $caller->isa($class)
!ll&&!rl&&r
2231
MC/DC100%2/2
$caller ne "main" and not $caller->isa($class)
$caller ne "main" not $caller->isa($class)
Truth table100%3/3
A and not(B)
A= $caller ne "main"B= not $caller->isa($class)
ABresult
0X0
100
111
22 21 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
23 31 push @{"${caller}::ISA"}, $class;
24 }
25 # Ordinary method calls, so the hint bits land in the scope being compiled
26 # - the caller's file - rather than in this one.
27 35 strict->import;
28 35 warnings->import;
29 35 return;
30 }
31  
32 21 1;
33  
34 __END__
« blib/lib/Punk/Validate.pm ↑ Summary xs/serve.xs »