AnyEvent/FTP/Server/UnambiguousResponseEncoder.pm

filter: Statementstmt 100% 24 / 24 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 100% 34 / 34 SCAR 11.0
CC
3
Cov
100%
encode
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
« AnyEvent/FTP/Response.pm ↑ Summary AnyEvent/FTP/Server/Context/FSRO.pm »
1 package AnyEvent::FTP::Server::UnambiguousResponseEncoder;
2  
3 25 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 25 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 25 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 25 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 # ABSTRACT: Server response encoder that encodes responses so they cannot be confused
9 25 our $VERSION = '0.19'; # VERSION
10  
11  
12 25 with 'AnyEvent::FTP::Server::Role::ResponseEncoder';
13  
14  
15 sub encode
16 {
17 819 ▶ my $self = shift;
Subroutine encode: called CC=3 SCAR=11.0
Pod documented
18  
19 819 my $code;
20 my $message;
21  
22 819 ▶ if(ref $_[0])
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_[0]) { } 3 816 819
23 {
24 3 $code = $_[0]->code;
25 3 $message = $_[0]->message;
26 }
27 else
28 {
29 816 ($code, $message) = @_;
30 }
31  
32 819 ▶ $message = [ $message ] unless ref($message) eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $message eq "ARRAY" 808 11 819
33  
34 819 my $last = pop @$message;
35  
36 819 return join "\015\012", (map { "$code-$_" } @$message), "$code $last\015\012";
37 }
38  
39 25 1;
40  
41 __END__
« AnyEvent/FTP/Response.pm ↑ Summary AnyEvent/FTP/Server/Context/FSRO.pm »