line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package lib::noop; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $DATE = '2016-12-27'; # DATE |
4
|
|
|
|
|
|
|
our $VERSION = '0.001'; # VERSION |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
560
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
7
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
308
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @mods; |
10
|
|
|
|
|
|
|
our $noop_code = "1;\n"; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $hook = sub { |
13
|
|
|
|
|
|
|
my ($self, $file) = @_; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $mod = $file; $mod =~ s/\.pm\z//; $mod =~ s!/!::!g; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# decline if not in list of module to noop |
18
|
|
|
|
|
|
|
return undef unless grep { $_ eq $mod } @mods; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
return \$noop_code; |
21
|
|
|
|
|
|
|
}; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub import { |
24
|
1
|
|
|
1
|
|
6
|
my $class = shift; |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
3
|
@mods = @_; |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
2
|
@INC = ($hook, grep { $_ ne "$hook" } @INC); |
|
11
|
|
|
|
|
17
|
|
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub unimport { |
32
|
1
|
50
|
|
1
|
|
383
|
return unless $hook; |
33
|
1
|
|
|
|
|
2
|
@mods = (); |
34
|
1
|
|
|
|
|
1
|
@INC = grep { "$_" ne "$hook" } @INC; |
|
12
|
|
|
|
|
17
|
|
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
# ABSTRACT: no-op loading some modules |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__ |