line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perinci::Sub::Util::DepModule; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $DATE = '2016-09-29'; # DATE |
4
|
|
|
|
|
|
|
our $VERSION = '0.001'; # VERSION |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
12547
|
use 5.010001; |
|
1
|
|
|
|
|
3
|
|
7
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
14
|
|
8
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
19
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
3
|
use Exporter qw(import); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
218
|
|
11
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
12
|
|
|
|
|
|
|
get_required_dep_modules |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub _find { |
16
|
5
|
|
|
5
|
|
6
|
my ($deps, $res) = @_; |
17
|
|
|
|
|
|
|
|
18
|
5
|
100
|
|
|
|
10
|
return unless $deps; |
19
|
4
|
|
|
|
|
4
|
$res->{"Perinci::Sub::DepChecker"} = 0; |
20
|
4
|
|
|
|
|
9
|
for my $k (keys %$deps) { |
21
|
5
|
100
|
|
|
|
21
|
if ($k =~ /\A(any|all|none)\z/) { |
|
|
100
|
|
|
|
|
|
22
|
1
|
|
|
|
|
3
|
my $v = $deps->{$k}; |
23
|
1
|
|
|
|
|
5
|
_find($_, $res) for @$v; |
24
|
|
|
|
|
|
|
} elsif ($k =~ /\A(env|code|prog|pkg|func|exec|tmp_dir|trash_dir|undo_trash_dir)\z/) { |
25
|
|
|
|
|
|
|
# skip builtin deps supported by Perinci::Sub::DepChecker |
26
|
|
|
|
|
|
|
} else { |
27
|
2
|
|
|
|
|
7
|
$res->{"Perinci::Sub::Dep::$k"} = 0; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub get_required_dep_modules { |
33
|
3
|
|
|
3
|
1
|
11
|
my $meta = shift; |
34
|
|
|
|
|
|
|
|
35
|
3
|
|
|
|
|
4
|
my %res; |
36
|
3
|
|
|
|
|
8
|
_find($meta->{deps}, \%res); |
37
|
3
|
|
|
|
|
12
|
\%res; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
# ABSTRACT: Given a Rinci function metadata, find what dep modules are required |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |