line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package AnyEvent::Ident::Response; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
1403
|
use strict; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
165
|
|
4
|
5
|
|
|
5
|
|
77
|
use warnings; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
3614
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: Simple asynchronous ident response |
7
|
|
|
|
|
|
|
our $VERSION = '0.06'; # VERSION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new |
10
|
|
|
|
|
|
|
{ |
11
|
22
|
|
|
22
|
0
|
380
|
my $class = shift; |
12
|
22
|
100
|
|
|
|
59
|
if(@_ == 1) |
13
|
|
|
|
|
|
|
{ |
14
|
13
|
|
|
|
|
1098
|
my $raw = shift; |
15
|
13
|
|
|
|
|
42
|
$raw =~ s/^\s+//; |
16
|
13
|
|
|
|
|
84
|
$raw =~ s/\s+$//; |
17
|
13
|
|
|
|
|
103
|
my ($pair, @list) = split /\s*:\s*/, $raw; |
18
|
13
|
|
|
|
|
59
|
my($server_port, $client_port) = split /\s*,\s*/, $pair; |
19
|
13
|
|
|
|
|
81
|
my $self = bless { |
20
|
|
|
|
|
|
|
raw => $raw, |
21
|
|
|
|
|
|
|
server_port => $server_port, |
22
|
|
|
|
|
|
|
client_port => $client_port |
23
|
|
|
|
|
|
|
}, $class; |
24
|
|
|
|
|
|
|
|
25
|
13
|
100
|
|
|
|
144
|
if($list[0] eq 'USERID') |
26
|
|
|
|
|
|
|
{ |
27
|
5
|
|
|
|
|
7
|
shift @list; |
28
|
5
|
|
|
|
|
31
|
($self->{os}, $self->{charset}) = split /\s,\s*/, shift @list; |
29
|
5
|
|
|
|
|
13
|
$self->{username} = shift @list; |
30
|
5
|
|
50
|
|
|
35
|
$self->{charset} ||= 'US-ASCII'; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
else |
33
|
|
|
|
|
|
|
{ |
34
|
8
|
|
|
|
|
14
|
shift @list; |
35
|
8
|
|
|
|
|
23
|
$self->{error_type} = shift @list; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
13
|
|
|
|
|
48
|
return $self; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
else |
41
|
|
|
|
|
|
|
{ |
42
|
9
|
50
|
|
|
|
50
|
my $args = ref $_[0] eq 'HASH' ? (\%{$_[0]}) : ({@_}); |
|
0
|
|
|
|
|
0
|
|
43
|
9
|
|
|
|
|
37
|
my $self = bless { |
44
|
|
|
|
|
|
|
server_port => $args->{req}->server_port, |
45
|
|
|
|
|
|
|
client_port => $args->{req}->client_port, |
46
|
|
|
|
|
|
|
username => $args->{username}, |
47
|
|
|
|
|
|
|
os => $args->{os}, |
48
|
|
|
|
|
|
|
charset => $args->{charset}, |
49
|
|
|
|
|
|
|
error_type => $args->{error_type}, |
50
|
|
|
|
|
|
|
}, $class; |
51
|
9
|
100
|
|
|
|
58
|
$self->{os} = 'OTHER' unless defined $self->{os}; |
52
|
9
|
100
|
|
|
|
40
|
if($self->{error_type}) |
|
|
50
|
|
|
|
|
|
53
|
|
|
|
|
|
|
{ |
54
|
4
|
|
|
|
|
25
|
$self->{raw} = join(':', join(',', $self->{server_port}, $self->{client_port}), 'ERROR', $self->{error_type}); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
elsif($self->{charset}) |
57
|
|
|
|
|
|
|
{ |
58
|
0
|
|
|
|
|
0
|
$self->{raw} = join(':', join(',', $self->{server_port}, $self->{client_port}), 'USERID', join(',', $self->{os}, $self->{charset}), $self->{username}); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
else |
61
|
|
|
|
|
|
|
{ |
62
|
5
|
|
|
|
|
47
|
$self->{raw} = join(':', join(',', $self->{server_port}, $self->{client_port}), 'USERID', $self->{os}, $self->{username}); |
63
|
|
|
|
|
|
|
} |
64
|
9
|
|
|
|
|
43
|
return $self; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub _key |
69
|
|
|
|
|
|
|
{ |
70
|
15
|
|
|
15
|
|
32
|
my($self) = @_; |
71
|
15
|
|
|
|
|
70
|
join ':', $self->{server_port}, $self->{client_port}; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
11
|
|
|
11
|
1
|
2033
|
sub as_string { shift->{raw} } |
76
|
15
|
|
|
15
|
1
|
11460
|
sub is_success { defined shift->{username} } |
77
|
4
|
|
|
4
|
1
|
17
|
sub server_port { shift->{server_port} } |
78
|
4
|
|
|
4
|
1
|
17
|
sub client_port { shift->{client_port} } |
79
|
6
|
|
|
6
|
1
|
34
|
sub username { shift->{username} } |
80
|
6
|
|
|
6
|
1
|
42
|
sub os { shift->{os} } |
81
|
0
|
|
|
0
|
1
|
0
|
sub charset { shift->{charset} } |
82
|
9
|
|
|
9
|
1
|
59
|
sub error_type { shift->{error_type} } |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
__END__ |