line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package AnyEvent::FTP::Server::UnambiguousResponseEncoder; |
2
|
|
|
|
|
|
|
|
3
|
25
|
|
|
25
|
|
214497
|
use strict; |
|
25
|
|
|
|
|
55
|
|
|
25
|
|
|
|
|
653
|
|
4
|
25
|
|
|
25
|
|
102
|
use warnings; |
|
25
|
|
|
|
|
39
|
|
|
25
|
|
|
|
|
512
|
|
5
|
25
|
|
|
25
|
|
393
|
use 5.010; |
|
25
|
|
|
|
|
70
|
|
6
|
25
|
|
|
25
|
|
555
|
use Moo; |
|
25
|
|
|
|
|
11819
|
|
|
25
|
|
|
|
|
368
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# ABSTRACT: Server response encoder that encodes responses so they cannot be confused |
9
|
|
|
|
|
|
|
our $VERSION = '0.19'; # VERSION |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
with 'AnyEvent::FTP::Server::Role::ResponseEncoder'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub encode |
16
|
|
|
|
|
|
|
{ |
17
|
819
|
|
|
819
|
1
|
14766
|
my $self = shift; |
18
|
|
|
|
|
|
|
|
19
|
819
|
|
|
|
|
1282
|
my $code; |
20
|
|
|
|
|
|
|
my $message; |
21
|
|
|
|
|
|
|
|
22
|
819
|
100
|
|
|
|
1641
|
if(ref $_[0]) |
23
|
|
|
|
|
|
|
{ |
24
|
3
|
|
|
|
|
6
|
$code = $_[0]->code; |
25
|
3
|
|
|
|
|
10
|
$message = $_[0]->message; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
else |
28
|
|
|
|
|
|
|
{ |
29
|
816
|
|
|
|
|
1495
|
($code, $message) = @_; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
819
|
100
|
|
|
|
2561
|
$message = [ $message ] unless ref($message) eq 'ARRAY'; |
33
|
|
|
|
|
|
|
|
34
|
819
|
|
|
|
|
1525
|
my $last = pop @$message; |
35
|
|
|
|
|
|
|
|
36
|
819
|
|
|
|
|
3258
|
return join "\015\012", (map { "$code-$_" } @$message), "$code $last\015\012"; |
|
16
|
|
|
|
|
62
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |