File Coverage

blib/lib/Acme/UseStrict.pm
Criterion Covered Total %
statement 10 12 83.3
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 14 16 87.5


line stmt bran cond sub pod time code
1             package Acme::UseStrict;
2              
3 2     2   100197 use 5.010;
  2         9  
  2         93  
4 2     2   13 use strict;
  2         4  
  2         75  
5 2     2   114417 use overload qw();
  2         8663  
  2         108  
6 2     2   17740 use match::smart qw(M);
  0            
  0            
7              
8             BEGIN {
9             $Acme::UseStrict::AUTHORITY = 'cpan:TOBYINK';
10             $Acme::UseStrict::VERSION = '1.234';
11             }
12              
13             sub import
14             {
15             my $class = shift;
16             my ($test) = @_;
17             $test //= 'use strict';
18            
19             my %overload = (
20             q => sub {
21             in_effect(1)
22             and $_[1] |M| $test
23             and $^H |= strict::bits(qw/refs subs vars/);
24             return $_[1];
25             },
26             );
27             overload::constant %overload;
28            
29             $^H{+__PACKAGE__} = 1;
30             }
31              
32             sub unimport
33             {
34             $^H{+__PACKAGE__} = 0;
35             }
36              
37             sub in_effect
38             {
39             my $level = $_[0] // 0;
40             my $hinthash = (caller($level))[10];
41             return $hinthash->{+__PACKAGE__};
42             }
43              
44             'use strict constantly';
45              
46             __END__