line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::UCP::TransactionManager; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
19835
|
use 5.008007; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
32
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
29
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
74
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
require Exporter; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
10
|
|
|
|
|
|
|
our @EXPORT = qw(); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
5
|
use constant HIGHEST_NBR => 99; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
438
|
|
15
|
|
|
|
|
|
|
|
16
|
0
|
|
|
0
|
0
|
|
sub new { bless({}, shift())->_init(@_); } |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub get_trn { |
19
|
0
|
|
|
0
|
0
|
|
my ($self, $resp) = @_; |
20
|
|
|
|
|
|
|
|
21
|
0
|
0
|
|
|
|
|
return unless defined $resp; |
22
|
0
|
0
|
|
|
|
|
return $1 if ($resp =~ m/^(\d{2}).*/); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub next_trn { |
26
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
$self->{TRN}++; |
29
|
0
|
0
|
|
|
|
|
($self->{TRN} > HIGHEST_NBR) && do{ $self->{TRN} = 0 }; |
|
0
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
return $self->{TRN}; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub current_trn { |
34
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
35
|
|
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
|
$self->reset_trn() if !defined $self->{TRN}; |
37
|
0
|
|
|
|
|
|
return $self->{TRN}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub set_trn { |
41
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
42
|
0
|
|
|
|
|
|
my $tmp_trn = shift; |
43
|
|
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
|
if ($tmp_trn =~ m/\A\d+\Z/) { |
45
|
0
|
|
|
|
|
|
$self->{TRN} = $tmp_trn; |
46
|
0
|
0
|
|
|
|
|
$self->{TRN} = 0 if ($self->{TRN} > HIGHEST_NBR); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
return $self->current_trn(); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub reset_trn { |
53
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
54
|
0
|
|
|
|
|
|
$self->{TRN} = 0; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub padding { |
58
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
59
|
0
|
|
|
|
|
|
return sprintf("%02d", $self->{TRN}); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub _init { |
63
|
0
|
|
|
0
|
|
|
my $self = shift; |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
$self->reset_trn(); |
66
|
0
|
|
|
|
|
|
$self; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |
70
|
|
|
|
|
|
|
__END__ |