line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Alien::Build::Plugin::Decode::SourceForge; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
266320
|
use strict; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
58
|
|
4
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
46
|
|
5
|
2
|
|
|
2
|
|
35
|
use 5.008001; |
|
2
|
|
|
|
|
7
|
|
6
|
2
|
|
|
2
|
|
861
|
use Alien::Build::Plugin; |
|
2
|
|
|
|
|
5084
|
|
|
2
|
|
|
|
|
13
|
|
7
|
2
|
|
|
2
|
|
1202
|
use URI; |
|
2
|
|
|
|
|
8866
|
|
|
2
|
|
|
|
|
532
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Alien::Build plugin to handle SourceForge links |
10
|
|
|
|
|
|
|
our $VERSION = '0.02'; # VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub init |
14
|
|
|
|
|
|
|
{ |
15
|
1
|
|
|
1
|
1
|
84314
|
my($self, $meta) = @_; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
|
|
7
|
$meta->add_requires( 'configure' => 'Alien::Build::Plugin::Decode::SourceForge' => 0 ); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
$meta->around_hook( |
20
|
|
|
|
|
|
|
decode => sub { |
21
|
1
|
|
|
1
|
|
11942
|
my($orig, $build, $html) = @_; |
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
|
|
5
|
my $list = $orig->($build, $html); |
24
|
|
|
|
|
|
|
|
25
|
1
|
50
|
|
|
|
11222
|
if($list->{type} eq 'list') |
26
|
|
|
|
|
|
|
{ |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
4
|
@{ $list->{list} } = map { _rewrite($_) } @{ $list->{list} } |
|
1
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
12
|
|
|
1
|
|
|
|
|
3
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
|
|
6
|
$list; |
33
|
|
|
|
|
|
|
}, |
34
|
1
|
|
|
|
|
24
|
); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub _rewrite |
38
|
|
|
|
|
|
|
{ |
39
|
3
|
|
|
3
|
|
8
|
my($link) = @_; |
40
|
|
|
|
|
|
|
|
41
|
3
|
|
|
|
|
10
|
my $uri = URI->new($link->{url}); |
42
|
|
|
|
|
|
|
|
43
|
3
|
50
|
|
|
|
185
|
return $link unless $uri->host eq 'sourceforge.net'; |
44
|
|
|
|
|
|
|
|
45
|
3
|
100
|
|
|
|
80
|
if($uri->path =~ m{/([^/]+)/download$}) |
46
|
|
|
|
|
|
|
{ |
47
|
|
|
|
|
|
|
return { |
48
|
|
|
|
|
|
|
filename => $1, |
49
|
|
|
|
|
|
|
url => $link->{url}, |
50
|
2
|
|
|
|
|
36
|
}; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
else |
53
|
|
|
|
|
|
|
{ |
54
|
1
|
|
|
|
|
13
|
return $link; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__END__ |