| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# Declare our package |
|
2
|
|
|
|
|
|
|
package CPAN::WWW::Top100::Retrieve::Utils; |
|
3
|
1
|
|
|
1
|
|
941
|
use strict; use warnings; |
|
|
1
|
|
|
1
|
|
2
|
|
|
|
1
|
|
|
|
|
42
|
|
|
|
1
|
|
|
|
|
5
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
35
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# Initialize our version |
|
6
|
1
|
|
|
1
|
|
16
|
use vars qw( $VERSION ); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
54
|
|
|
7
|
|
|
|
|
|
|
$VERSION = '0.01'; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# set ourself up for exporting |
|
10
|
1
|
|
|
1
|
|
5
|
use base qw( Exporter ); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
382
|
|
|
11
|
|
|
|
|
|
|
our @EXPORT_OK = qw( default_top100_uri |
|
12
|
|
|
|
|
|
|
dbid2type type2dbid types dbids |
|
13
|
|
|
|
|
|
|
); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub default_top100_uri { |
|
16
|
0
|
|
|
0
|
1
|
|
return 'http://ali.as/top100/data.html'; |
|
17
|
|
|
|
|
|
|
} |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# TODO hardcoded from CPAN::WWW::Top100::Generator v0.08 |
|
20
|
|
|
|
|
|
|
my %dbid_type = ( |
|
21
|
|
|
|
|
|
|
1 => 'heavy', |
|
22
|
|
|
|
|
|
|
2 => 'volatile', |
|
23
|
|
|
|
|
|
|
3 => 'debian', |
|
24
|
|
|
|
|
|
|
4 => 'downstream', |
|
25
|
|
|
|
|
|
|
5 => 'meta1', |
|
26
|
|
|
|
|
|
|
6 => 'meta2', |
|
27
|
|
|
|
|
|
|
7 => 'meta3', |
|
28
|
|
|
|
|
|
|
8 => 'fail', |
|
29
|
|
|
|
|
|
|
); |
|
30
|
|
|
|
|
|
|
my %type_dbid; |
|
31
|
|
|
|
|
|
|
foreach my $k ( keys %dbid_type ) { |
|
32
|
|
|
|
|
|
|
$type_dbid{ $dbid_type{ $k } } = $k; |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub dbid2type { |
|
36
|
0
|
|
|
0
|
1
|
|
my $id = shift; |
|
37
|
0
|
0
|
|
|
|
|
if ( exists $dbid_type{ $id } ) { |
|
38
|
0
|
|
|
|
|
|
return $dbid_type{ $id }; |
|
39
|
|
|
|
|
|
|
} else { |
|
40
|
0
|
|
|
|
|
|
return; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
sub type2dbid { |
|
44
|
0
|
|
|
0
|
1
|
|
my $type = shift; |
|
45
|
0
|
0
|
|
|
|
|
if ( exists $type_dbid{ $type } ) { |
|
46
|
0
|
|
|
|
|
|
return $type_dbid{ $type }; |
|
47
|
|
|
|
|
|
|
} else { |
|
48
|
0
|
|
|
|
|
|
return; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub types { |
|
53
|
0
|
|
|
0
|
1
|
|
return [ keys %type_dbid ]; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub dbids { |
|
57
|
0
|
|
|
0
|
1
|
|
return [ keys %dbid_type ]; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
|
61
|
|
|
|
|
|
|
__END__ |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=for stopwords todo Top100 IDs dbid dbids uri |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 NAME |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
CPAN::WWW::Top100::Retrieve::Utils - Various utilities for Top100 retrieval |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
#!/usr/bin/perl |
|
72
|
|
|
|
|
|
|
use strict; use warnings; |
|
73
|
|
|
|
|
|
|
use CPAN::WWW::Top100::Retrieve::Utils qw( default_top100_uri ); |
|
74
|
|
|
|
|
|
|
print "The default Top100 uri is: " . default_top100_uri() . "\n"; |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
This module holds the various utility functions used in the Top100 modules. Normally you wouldn't |
|
79
|
|
|
|
|
|
|
need to use this directly. |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head2 Methods |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head3 default_top100_uri |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Returns the Top100 uri we use to retrieve data. |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
The current uri is: |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
return 'http://ali.as/top100/data.html'; |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head3 types |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Returns an arrayref of Top100 database types. |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
The current types is: |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
return [ qw( heavy volatile debian downstream meta1 meta2 meta3 fail ) ]; |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head3 dbids |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Returns an arrayref of Top100 database type IDs. |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
The current dbids is: |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
return [ qw( 1 2 3 4 5 6 7 8 ) ]; |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head3 dbid2type |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Returns the type given a dbid. |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head3 type2dbid |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Returns the dbid given a type. |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 AUTHOR |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Apocalypse E<lt>apocal@cpan.orgE<gt> |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Copyright 2010 by Apocalypse |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
|
124
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
The full text of the license can be found in the LICENSE file included with this module. |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=cut |