line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::PT; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
19488
|
use 5.006; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
56
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings FATAL => 'all'; |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
53
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Net::PT - The great new Net::PT! |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Version 0.01 |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
Copyright 2013 Paul Taylor. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
This program is released under the following license: BSD |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=cut |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
1
|
|
10
|
use 5.006; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
33
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
34
|
1
|
|
|
1
|
|
4
|
use warnings FATAL => 'all'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
25
|
|
35
|
|
|
|
|
|
|
|
36
|
1
|
|
|
1
|
|
886
|
use Time::HiRes qw(gettimeofday); |
|
1
|
|
|
|
|
1790
|
|
|
1
|
|
|
|
|
4
|
|
37
|
1
|
|
|
1
|
|
1025
|
use Math::Random::Secure qw(irand); |
|
1
|
|
|
|
|
95792
|
|
|
1
|
|
|
|
|
66
|
|
38
|
1
|
|
|
1
|
|
1001
|
use JSON; |
|
1
|
|
|
|
|
12904
|
|
|
1
|
|
|
|
|
7
|
|
39
|
1
|
|
|
1
|
|
1045
|
use MIME::Base64 qw(decode_base64 decode_base64url encode_base64url); |
|
1
|
|
|
|
|
691
|
|
|
1
|
|
|
|
|
87
|
|
40
|
1
|
|
|
1
|
|
691
|
use Crypt::Mac::HMAC qw( hmac_b64u ); |
|
1
|
|
|
|
|
6331
|
|
|
1
|
|
|
|
|
62
|
|
41
|
1
|
|
|
1
|
|
10
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
63
|
|
42
|
1
|
|
|
1
|
|
720
|
use URI::Encode qw(uri_encode); |
|
1
|
|
|
|
|
13896
|
|
|
1
|
|
|
|
|
78
|
|
43
|
1
|
|
|
1
|
|
983
|
use Mozilla::CA; |
|
1
|
|
|
|
|
268
|
|
|
1
|
|
|
|
|
28
|
|
44
|
|
|
|
|
|
|
|
45
|
1
|
|
|
1
|
|
501
|
use Data::Printer; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub test { |
48
|
|
|
|
|
|
|
my ($class, $s) = @_; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
print "Net::PT - test(${class}, ${s})\n"; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
my $map = { |
53
|
|
|
|
|
|
|
class => $class, |
54
|
|
|
|
|
|
|
msg => $s |
55
|
|
|
|
|
|
|
}; |
56
|
|
|
|
|
|
|
print "Net::PT - map = \n"; |
57
|
|
|
|
|
|
|
p $map; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
my $json = encode_json $map; |
61
|
|
|
|
|
|
|
print "Net:PT - json = \n"; |
62
|
|
|
|
|
|
|
p $json; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
my $b64 = encode_base64url $json; |
65
|
|
|
|
|
|
|
print "Net::PT - base64 url = \n"; |
66
|
|
|
|
|
|
|
p $b64; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
my $key = "monkey"; |
69
|
|
|
|
|
|
|
my $hmac = hmac_b64u('SHA256', $key, $b64); |
70
|
|
|
|
|
|
|
print "Net::PT - hmac = \n"; |
71
|
|
|
|
|
|
|
p $hmac; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
my $json2 = decode_base64url $b64; |
74
|
|
|
|
|
|
|
print "Net:PT - json2 = \n"; |
75
|
|
|
|
|
|
|
p $json2; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
my $map2 = decode_json $json2; |
78
|
|
|
|
|
|
|
print "Net:PT - map2 = \n"; |
79
|
|
|
|
|
|
|
p $map2; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |
89
|
|
|
|
|
|
|
|