blib/lib/Acme/use/strict/with/pride.pm

filter: Statementstmt 96.0% 24 / 25 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 94.5% 35 / 37 CC 5 SCAR 8.9
CC
5
Cov
94%
__ANON__
4.0
__ANON__
2.1
import
1.0
CRAP 2.4
↑ Summary
1 package Acme::use::strict::with::pride;
2  
3 1 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 our $VERSION = '0.04';
8  
9 1 our $script;
10  
11 1 ▶sub import {
Subroutine import: called CC=1 SCAR=0.0
12 # OK. This is a big hack. I'm going to ignore any arguments.
13 25 ▶ unshift @INC, sub {
Subroutine __ANON__: called CC=4 SCAR=13.9
14 25 my ($self, $file) = @_;
15 25 foreach my $dir (@INC) {
16 180 ▶ next if ref $dir;
Branch: 1 branch
BranchTrueFalseTotal
if ref $dir 25 155 180
17 155 my $full = "$dir/$file";
18 155 ▶ if (open my $fh, "<", $full) {
Branch: 1 branch
BranchTrueFalseTotal
if (open my $fh, "<", $full) 23 132 155
19 # Dave made us do this too:
20 23 my @lines = ("use strict; use warnings;\n", "#line 1 \"$full\"\n");
21 # You didn't see this:
22 9477 ▶ return ($fh, sub {
Subroutine __ANON__: called CC=2 SCAR=7.4
23 # We really ought to (a) document or rescind this feature
24 # (b) if we document it, change the implementation to use filter
25 # simple
26 # (c) if so, check whether it falls foul of the subtle trap of
27 # caller-filter leaves some data in the buffer, and filter gets to see
28 # it in $_ for a second time.
29 9477 ▶ if (@lines) {
Branch: 1 branch
BranchTrueFalseTotal
if (@lines) 9477 0 9477
30 9477 push @lines, $_;
31 9477 $_ = shift @lines;
32 9477 return length $_;
33 }
34 0 return 0;
35 23 });
36 }
37 }
38 2 return;
39 }
40 1 };
41  
42 1 1;
43 __END__
↑ Summary