line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package AnyEvent::FTP::Server::UnambiguousResponseEncoder; |
2
|
|
|
|
|
|
|
|
3
|
25
|
|
|
25
|
|
255013
|
use strict; |
|
25
|
|
|
|
|
65
|
|
|
25
|
|
|
|
|
931
|
|
4
|
25
|
|
|
25
|
|
161
|
use warnings; |
|
25
|
|
|
|
|
61
|
|
|
25
|
|
|
|
|
725
|
|
5
|
25
|
|
|
25
|
|
639
|
use 5.010; |
|
25
|
|
|
|
|
110
|
|
6
|
25
|
|
|
25
|
|
777
|
use Moo; |
|
25
|
|
|
|
|
12880
|
|
|
25
|
|
|
|
|
495
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# ABSTRACT: Server response encoder that encodes responses so they cannot be confused |
9
|
|
|
|
|
|
|
our $VERSION = '0.17'; # VERSION |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
with 'AnyEvent::FTP::Server::Role::ResponseEncoder'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub encode |
16
|
|
|
|
|
|
|
{ |
17
|
819
|
|
|
819
|
1
|
19640
|
my $self = shift; |
18
|
|
|
|
|
|
|
|
19
|
819
|
|
|
|
|
1754
|
my $code; |
20
|
|
|
|
|
|
|
my $message; |
21
|
|
|
|
|
|
|
|
22
|
819
|
100
|
|
|
|
2144
|
if(ref $_[0]) |
23
|
|
|
|
|
|
|
{ |
24
|
3
|
|
|
|
|
9
|
$code = $_[0]->code; |
25
|
3
|
|
|
|
|
11
|
$message = $_[0]->message; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
else |
28
|
|
|
|
|
|
|
{ |
29
|
816
|
|
|
|
|
2281
|
($code, $message) = @_; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
819
|
100
|
|
|
|
3348
|
$message = [ $message ] unless ref($message) eq 'ARRAY'; |
33
|
|
|
|
|
|
|
|
34
|
819
|
|
|
|
|
1968
|
my $last = pop @$message; |
35
|
|
|
|
|
|
|
|
36
|
819
|
|
|
|
|
4542
|
return join "\015\012", (map { "$code-$_" } @$message), "$code $last\015\012"; |
|
16
|
|
|
|
|
86
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |