File Coverage

blib/lib/Acme/use/strict/with/pride.pm
Criterion Covered Total %
statement 22 23 95.6
branch 5 6 83.3
condition n/a
subroutine 5 5 100.0
pod n/a
total 32 34 94.1


line stmt bran cond sub pod time code
1             package Acme::use::strict::with::pride;
2              
3 1     1   31266 use 5.006;
  1         6  
  1         45  
4 1     1   6 use strict;
  1         2  
  1         29  
5 1     1   7 use warnings;
  1         2  
  1         923  
6              
7             our $VERSION = '0.04';
8              
9             our $script;
10              
11             sub import {
12             # OK. This is a big hack. I'm going to ignore any arguments.
13             unshift @INC, sub {
14 5     5   90256 my ($self, $file) = @_;
15 5         12 foreach my $dir (@INC) {
16 46 100       95 next if ref $dir;
17 41         72 my $full = "$dir/$file";
18 41 100       1137 if (open my $fh, "<", $full) {
19             # Dave made us do this too:
20 4         15 my @lines = ("use strict; use warnings;\n", "#line 1 \"$full\"\n");
21             # You didn't see this:
22             return ($fh, sub {
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 350 50       2138 if (@lines) {
30 350         800 push @lines, $_;
31 350         646 $_ = shift @lines;
32 350         73971 return length $_;
33             }
34 0         0 return 0;
35 4         234 });
36             }
37             }
38 1         375 return;
39             }
40 1     1   1956 };
41              
42             1;
43             __END__