line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CPAN::YACSmoke::Plugin::PlainTextList; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
25397
|
use 5.006001; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
80
|
|
4
|
2
|
|
|
2
|
|
238
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
85
|
|
5
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
218
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ------------------------------------- |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
CPAN::YACSmoke::Plugin::PlainTextList - Plain text file plugin for CPAN::YACSmoke |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use CPAN::YACSmoke; |
18
|
|
|
|
|
|
|
my $config = { |
19
|
|
|
|
|
|
|
list_from => 'PlainTextList', |
20
|
|
|
|
|
|
|
data => 'datafile.txt' |
21
|
|
|
|
|
|
|
}; |
22
|
|
|
|
|
|
|
my $foo = CPAN::YACSmoke->new(config => $config); |
23
|
|
|
|
|
|
|
my @list = $foo->download_list(); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 DESCRIPTION |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
This module provides the backend ability to access a list of current |
28
|
|
|
|
|
|
|
distributions available for testing, in a plain text data file. Each |
29
|
|
|
|
|
|
|
distribution should appear on a separate line, with the complete CPAN |
30
|
|
|
|
|
|
|
author name path, eg: |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
B/BA/BARBIE/CPAN-YACSmoke-Plugin-PlainTextList-0.01 |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
This module should be use together with CPAN::YACSmoke. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# ------------------------------------- |
39
|
|
|
|
|
|
|
# Library Modules |
40
|
|
|
|
|
|
|
|
41
|
2
|
|
|
2
|
|
995
|
use CPAN::YACSmoke; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
155
|
|
42
|
2
|
|
|
2
|
|
15
|
use IO::File; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
926
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# ------------------------------------- |
45
|
|
|
|
|
|
|
# The Subs |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=over 4 |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=item new() |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Creates the plugin object. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=back |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub new { |
60
|
1
|
|
50
|
1
|
1
|
26
|
my $class = shift || __PACKAGE__; |
61
|
1
|
|
|
|
|
3
|
my $hash = shift; |
62
|
|
|
|
|
|
|
|
63
|
1
|
|
|
|
|
4
|
my $self = {}; |
64
|
1
|
|
|
|
|
5
|
foreach my $field (qw( smoke data )) { |
65
|
2
|
100
|
|
|
|
11
|
$self->{$field} = $hash->{$field} if(exists $hash->{$field}); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
1
|
50
|
|
|
|
9
|
unless($self->{data}) { |
69
|
0
|
|
|
|
|
0
|
$self->{smoke}->error("No data file specified"); |
70
|
0
|
|
|
|
|
0
|
return undef; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
1
|
50
|
|
|
|
42
|
unless(-f $self->{data}) { |
74
|
0
|
|
|
|
|
0
|
$self->{smoke}->error("Cannot access data file [$self->{data}]"); |
75
|
0
|
|
|
|
|
0
|
return undef; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
1
|
|
|
|
|
7
|
bless $self, $class; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 METHODS |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=over 4 |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item download_list() |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Return the list of distributions within the data file. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub download_list { |
92
|
1
|
|
|
1
|
1
|
1245
|
my $self = shift; |
93
|
1
|
|
|
|
|
5
|
my @distros; |
94
|
|
|
|
|
|
|
|
95
|
1
|
|
|
|
|
21
|
my $fh = IO::File->new($self->{data}); |
96
|
1
|
50
|
|
|
|
224
|
unless($fh) { |
97
|
0
|
|
|
|
|
0
|
$self->{smoke}->error("Cannot open data file [$self->{data}]"); |
98
|
0
|
|
|
|
|
0
|
return undef; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
1
|
|
|
|
|
46
|
while(<$fh>) { chomp; push @distros, $_; } |
|
22
|
|
|
|
|
26
|
|
|
22
|
|
|
|
|
67
|
|
102
|
1
|
|
|
|
|
12
|
$fh->close(); |
103
|
|
|
|
|
|
|
|
104
|
1
|
|
|
|
|
29
|
return @distros; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
1; |
108
|
|
|
|
|
|
|
__END__ |