line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package AnyEvent::FTP::Server::UnambiguousResponseEncoder; |
2
|
|
|
|
|
|
|
|
3
|
25
|
|
|
25
|
|
232630
|
use strict; |
|
25
|
|
|
|
|
74
|
|
|
25
|
|
|
|
|
945
|
|
4
|
25
|
|
|
25
|
|
149
|
use warnings; |
|
25
|
|
|
|
|
59
|
|
|
25
|
|
|
|
|
703
|
|
5
|
25
|
|
|
25
|
|
2464
|
use 5.010; |
|
25
|
|
|
|
|
140
|
|
6
|
25
|
|
|
25
|
|
776
|
use Moo; |
|
25
|
|
|
|
|
12151
|
|
|
25
|
|
|
|
|
504
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# ABSTRACT: Server response encoder that encodes responses so they cannot be confused |
9
|
|
|
|
|
|
|
our $VERSION = '0.18'; # VERSION |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
with 'AnyEvent::FTP::Server::Role::ResponseEncoder'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub encode |
16
|
|
|
|
|
|
|
{ |
17
|
819
|
|
|
819
|
1
|
18809
|
my $self = shift; |
18
|
|
|
|
|
|
|
|
19
|
819
|
|
|
|
|
1715
|
my $code; |
20
|
|
|
|
|
|
|
my $message; |
21
|
|
|
|
|
|
|
|
22
|
819
|
100
|
|
|
|
2207
|
if(ref $_[0]) |
23
|
|
|
|
|
|
|
{ |
24
|
3
|
|
|
|
|
9
|
$code = $_[0]->code; |
25
|
3
|
|
|
|
|
7
|
$message = $_[0]->message; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
else |
28
|
|
|
|
|
|
|
{ |
29
|
816
|
|
|
|
|
2240
|
($code, $message) = @_; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
819
|
100
|
|
|
|
3378
|
$message = [ $message ] unless ref($message) eq 'ARRAY'; |
33
|
|
|
|
|
|
|
|
34
|
819
|
|
|
|
|
2109
|
my $last = pop @$message; |
35
|
|
|
|
|
|
|
|
36
|
819
|
|
|
|
|
4441
|
return join "\015\012", (map { "$code-$_" } @$message), "$code $last\015\012"; |
|
16
|
|
|
|
|
76
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |