Server/Command/Lsub.pm untested

filter: Statementstmt 0.0% 0 / 24 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 18 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 55 CC 5 SCAR 29.7
CC
5
Cov
0%
traverse
30.0
BEGIN
2.0
BEGIN
2.0
CRAP 19.5
1 package Net::IMAP::Server::Command::Lsub;
2  
3 use warnings;
4 use strict;
5  
6 use base qw/Net::IMAP::Server::Command::List/;
7  
8 sub traverse {
9 my $self = shift;
10 my $node = shift;
11 my $regex = shift;
12  
13 $self->list_out($node) if $node->parent and $node->full_path =~ $regex and $node->subscribed;
14 my @kids = grep {$_} map {$self->traverse( $_, $regex )} @{ $node->children };
15 if (@kids and $node->parent and not $node->subscribed) {
16 if ($node->full_path =~ $regex) {
17 $self->list_out($node, '\NoSelect');
18 return 0;
19 } else {
20 return 1;
21 }
22 }
23 return 1 if $node->parent and not $node->full_path =~ $regex and $node->subscribed;
24 return 0;
25 }
26  
27 1;