Server/Command/Namespace.pm untested

filter: Statementstmt 0.0% 0 / 22 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 35 CC 4 SCAR 19.1
CC
4
Cov
0%
validate
12.0
run
6.0
BEGIN
2.0
CRAP 6.8
1 package Net::IMAP::Server::Command::Namespace;
2  
3 use warnings;
4 use strict;
5  
6 use base qw/Net::IMAP::Server::Command/;
7  
8 sub validate {
9 my $self = shift;
10  
11 return $self->bad_command("Login first") if $self->connection->is_unauth;
12  
13 my @options = $self->parsed_options;
14 return $self->bad_command("Too many options") if @options;
15  
16 return 1;
17 }
18  
19 sub run {
20 my $self = shift;
21  
22 my @namespaces = $self->connection->model->namespaces;
23 @namespaces = map {
24 ref($_) eq "ARRAY"
25 ? "(" . join( "", map { $self->data_out($_) } @{$_} ) . ")"
26 : $self->data_out($_)
27 } @namespaces;
28 $self->untagged_response(join(" ", NAMESPACE => @namespaces));
29  
30 $self->ok_completed();
31 }
32  
33 1;