line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
3
|
|
|
3
|
|
52330
|
use utf8; |
|
3
|
|
|
|
|
13
|
|
|
3
|
|
|
|
|
13
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Net::EGTS::SubRecord::Auth::DispatcherIdentity; |
4
|
3
|
|
|
3
|
|
452
|
use Mouse; |
|
3
|
|
|
|
|
20591
|
|
|
3
|
|
|
|
|
17
|
|
5
|
|
|
|
|
|
|
extends qw(Net::EGTS::SubRecord); |
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
862
|
use Carp; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
162
|
|
8
|
3
|
|
|
3
|
|
445
|
use List::MoreUtils qw(natatime); |
|
3
|
|
|
|
|
9784
|
|
|
3
|
|
|
|
|
13
|
|
9
|
3
|
|
|
3
|
|
3026
|
use Encode qw(); |
|
3
|
|
|
|
|
21771
|
|
|
3
|
|
|
|
|
66
|
|
10
|
|
|
|
|
|
|
|
11
|
3
|
|
|
3
|
|
295
|
use Net::EGTS::Util qw(usize dumper_bitstring); |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
133
|
|
12
|
3
|
|
|
3
|
|
293
|
use Net::EGTS::Codes; |
|
3
|
|
|
|
|
84
|
|
|
3
|
|
|
|
|
734
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# Dispatcher Type |
15
|
|
|
|
|
|
|
has DT => is => 'rw', isa => 'BYTE', default => 0; |
16
|
|
|
|
|
|
|
# Dispatcher ID |
17
|
|
|
|
|
|
|
has DID => is => 'rw', isa => 'UINT'; |
18
|
|
|
|
|
|
|
# Description |
19
|
|
|
|
|
|
|
has DSCR => |
20
|
|
|
|
|
|
|
is => 'rw', |
21
|
|
|
|
|
|
|
isa => 'Maybe[STRING]', |
22
|
|
|
|
|
|
|
trigger => sub { |
23
|
|
|
|
|
|
|
my ($self, $value, $old) = @_; |
24
|
3
|
|
|
3
|
|
17
|
use bytes; |
|
3
|
|
|
|
|
12
|
|
|
3
|
|
|
|
|
13
|
|
25
|
|
|
|
|
|
|
die 'Description too long' if defined($value) && length($value) > 255; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
after 'decode' => sub { |
30
|
|
|
|
|
|
|
my ($self) = @_; |
31
|
|
|
|
|
|
|
die 'SubRecord not EGTS_SR_DISPATCHER_IDENTITY type' |
32
|
|
|
|
|
|
|
unless $self->SRT == EGTS_SR_DISPATCHER_IDENTITY; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my $bin = $self->SRD; |
35
|
|
|
|
|
|
|
$self->DT( $self->nip(\$bin => 'C') ); |
36
|
|
|
|
|
|
|
$self->DID( $self->nip(\$bin => 'L') ); |
37
|
|
|
|
|
|
|
$self->DSCR( $self->nip(\$bin => 'a*' => length($bin)) ); |
38
|
|
|
|
|
|
|
}; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
before 'encode' => sub { |
41
|
|
|
|
|
|
|
my ($self) = @_; |
42
|
|
|
|
|
|
|
die 'SubRecord not EGTS_SR_DISPATCHER_IDENTITY type' |
43
|
|
|
|
|
|
|
unless $self->SRT == EGTS_SR_DISPATCHER_IDENTITY; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
my $bin = pack 'C L' => $self->DT, $self->DID; |
46
|
|
|
|
|
|
|
$bin .= pack 'a*' => $self->DSCR if defined $self->DSCR; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
$self->SRD( $bin ); |
49
|
|
|
|
|
|
|
}; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
around BUILDARGS => sub { |
52
|
|
|
|
|
|
|
my $orig = shift; |
53
|
|
|
|
|
|
|
my $class = shift; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# simple scalar decoding support |
56
|
|
|
|
|
|
|
my $bin = @_ % 2 ? shift : undef; |
57
|
|
|
|
|
|
|
my %opts = @_; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# Description is CP-1251 |
60
|
|
|
|
|
|
|
$opts{DSCR} = Encode::encode('CP1251', $opts{DSCR}) if defined $opts{DSCR}; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
return $class->$orig( bin => $bin, %opts, SRT => EGTS_SR_DISPATCHER_IDENTITY) |
63
|
|
|
|
|
|
|
if $bin; |
64
|
|
|
|
|
|
|
return $class->$orig( %opts, SRT => EGTS_SR_DISPATCHER_IDENTITY); |
65
|
|
|
|
|
|
|
}; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
augment as_debug => sub { |
68
|
|
|
|
|
|
|
my ($self) = @_; |
69
|
3
|
|
|
3
|
|
951
|
use bytes; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
22
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
my @bytes = ((unpack('B*', $self->SRD)) =~ m{.{8}}g); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
my @str; |
74
|
|
|
|
|
|
|
push @str => sprintf('DT: %s', splice @bytes, 0 => usize('C')); |
75
|
|
|
|
|
|
|
push @str => sprintf('DID: %s %s %s %s', splice @bytes, 0 => usize('L')); |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
my $it = natatime 4, @bytes; |
78
|
|
|
|
|
|
|
my @chunks; |
79
|
|
|
|
|
|
|
while (my @vals = $it->()) { |
80
|
|
|
|
|
|
|
push @chunks, join(' ', @vals); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
push @str => sprintf('DSCR: %s', join("\n ", @chunks)); |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
return @str; |
85
|
|
|
|
|
|
|
}; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable(); |