forked from miyagawa/cpanminus
/
bundle
32 lines (27 loc) · 934 Bytes
/
bundle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
name 'bundle';
description 'Support scanning dependencies from Bundle:: modules';
author 'Tatsuhiko Miyagawa';
api_version 0.1;
hook find_deps => sub {
my $args = shift;
if ($args->{module} =~ m!^Bundle::!) {
my @module = split /::/, $args->{module};
my $base = $module[-1] . ".pm";
my $lib = join("/", "lib", @module) . ".pm";
for my $file (grep -e, ($base, $lib)) {
$self->chat("Scanning $file for bundle dependencies...");
open my $pod, "<$file" or next;
my $in_contents;
while (<$pod>) {
if (/^=head\d\s+CONTENTS/) {
$in_contents = 1;
} elsif (/^=/) {
$in_contents = 0;
} elsif ($in_contents) {
/^([\w:]+)/
and push @{$args->{deps}}, $1, 0;
}
}
}
}
};