line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::Live::Auth::Offer; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
34
|
|
4
|
1
|
|
|
1
|
|
29
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
4
|
use WWW::Live::Auth::Utils; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
119
|
|
7
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
376
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
0
|
|
|
0
|
0
|
|
my ( $proto, %args ) = @_; |
11
|
0
|
|
0
|
|
|
|
my $class = ref $proto || $proto; |
12
|
0
|
|
|
|
|
|
my $self = bless { |
13
|
|
|
|
|
|
|
'offer' => $args{'offer'}, |
14
|
|
|
|
|
|
|
'action' => $args{'action'}, |
15
|
|
|
|
|
|
|
'expires' => $args{'expires'} |
16
|
|
|
|
|
|
|
}, $class; |
17
|
0
|
|
|
|
|
|
$self->_process; |
18
|
0
|
|
|
|
|
|
return $self; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub offer { |
22
|
0
|
|
|
0
|
0
|
|
my ( $self ) = @_; |
23
|
0
|
|
|
|
|
|
return $self->{'offer'}; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub action { |
27
|
0
|
|
|
0
|
0
|
|
my ( $self ) = @_; |
28
|
0
|
|
|
|
|
|
return $self->{'action'}; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub expires { |
32
|
0
|
|
|
0
|
0
|
|
my ( $self ) = @_; |
33
|
0
|
|
|
|
|
|
return $self->{'expires'}; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub as_string { |
37
|
0
|
|
|
0
|
0
|
|
my ( $self ) = @_; |
38
|
0
|
|
|
|
|
|
return $self->offer . '.' . $self->action; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _process { |
42
|
0
|
|
|
0
|
|
|
my ( $self ) = @_; |
43
|
0
|
0
|
|
|
|
|
if ( !$self->{'action'} ) { |
44
|
0
|
|
|
|
|
|
my ($offer, $action, $expires) = split /[\.:]/, $self->{'offer'}; |
45
|
0
|
|
0
|
|
|
|
$self->{'offer'} = $offer || croak('Could not parse offer'); |
46
|
0
|
|
0
|
|
|
|
$self->{'action'} = $action || croak('Could not parse offer action'); |
47
|
0
|
|
|
|
|
|
$self->{'expires'}; # optional |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
__END__ |