line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
363
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
42
|
|
2
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
61
|
|
3
|
|
|
|
|
|
|
package CPAN::Testers::Common::Utils; |
4
|
|
|
|
|
|
|
# ABSTRACT: Utility functions for CPAN Testers modules |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.003'; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
4
|
use Exporter (); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
163
|
|
9
|
|
|
|
|
|
|
our @ISA = qw/Exporter/; |
10
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
11
|
|
|
|
|
|
|
nntp_to_guid |
12
|
|
|
|
|
|
|
guid_to_nntp |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
15
|
|
|
|
|
|
|
all => [@EXPORT_OK] |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
#--------------------------------------------------------------------------# |
19
|
|
|
|
|
|
|
# NNTP <-> GUID |
20
|
|
|
|
|
|
|
#--------------------------------------------------------------------------# |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# Base GUID generated with: |
23
|
|
|
|
|
|
|
# Data::UUID->new->create_from_name_str( |
24
|
|
|
|
|
|
|
# NameSpace_URL, "http://nntp.x.perl.org/group/perl.cpan.testers" |
25
|
|
|
|
|
|
|
# ); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Lower case is canonical |
28
|
|
|
|
|
|
|
my $base_guid = "ed372d00-b19f-3f77-b713-d32bba55d77f"; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# strip leading zeros on extraction |
31
|
|
|
|
|
|
|
my $nntp_re = qr{\A0*([0-9]{1,7})-b19f-3f77-b713-d32bba55d77f$}; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub nntp_to_guid { |
34
|
2
|
|
|
2
|
1
|
7
|
my ($nntp_id) = @_; |
35
|
2
|
|
|
|
|
2
|
my $guid = $base_guid; |
36
|
2
|
|
|
|
|
8
|
substr($guid, 0, 8, sprintf("%08d",$nntp_id)); # zero padded |
37
|
2
|
|
|
|
|
8
|
return $guid; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub guid_to_nntp { |
41
|
3
|
|
|
3
|
1
|
4
|
my ($guid) = @_; |
42
|
3
|
|
|
|
|
13
|
my ($nntp_id) = $guid =~ $nntp_re; |
43
|
3
|
|
|
|
|
8
|
return $nntp_id; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
__END__ |