| 1 | # Copyrights 2001-2020 by [Mark Overmeer]. | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # For other contributors see ChangeLog. | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # See the manual pages for details on the licensing terms. | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # Pod stripped from pm file by OODoc 2.02. | ||||||||||||||||||||||||||||||||||||||||||
| 5 | # This code is part of distribution Mail-Box. Meta-POD processed with | ||||||||||||||||||||||||||||||||||||||||||
| 6 | # OODoc into POD and HTML manual-pages. See README.md | ||||||||||||||||||||||||||||||||||||||||||
| 7 | # Copyright Mark Overmeer. Licensed under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | package Mail::Box::Manager; | ||||||||||||||||||||||||||||||||||||||||||
| 10 | 14 | ▶ | use vars '$VERSION'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 14 | $VERSION = '3.009'; | |||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 14 | ▶ | use base 'Mail::Reporter'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 14 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 14 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | 14 | ▶ | use Mail::Box; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | 14 | ▶ | use List::Util 'first'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | 14 | ▶ | use Scalar::Util 'weaken'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | # failed compilation will not complain a second time | ||||||||||||||||||||||||||||||||||||||||||
| 24 | # so we need to keep track. | ||||||||||||||||||||||||||||||||||||||||||
| 25 | 14 | my %require_failed; | |||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | 14 | my @basic_folder_types = | |||||||||||||||||||||||||||||||||||||||||
| 29 | ( [ mbox => 'Mail::Box::Mbox' ] | ||||||||||||||||||||||||||||||||||||||||||
| 30 | , [ mh => 'Mail::Box::MH' ] | ||||||||||||||||||||||||||||||||||||||||||
| 31 | , [ maildir => 'Mail::Box::Maildir' ] | ||||||||||||||||||||||||||||||||||||||||||
| 32 | , [ pop => 'Mail::Box::POP3' ] | ||||||||||||||||||||||||||||||||||||||||||
| 33 | , [ pop3 => 'Mail::Box::POP3' ] | ||||||||||||||||||||||||||||||||||||||||||
| 34 | , [ pops => 'Mail::Box::POP3s' ] | ||||||||||||||||||||||||||||||||||||||||||
| 35 | , [ pop3s => 'Mail::Box::POP3s' ] | ||||||||||||||||||||||||||||||||||||||||||
| 36 | , [ imap => 'Mail::Box::IMAP4' ] | ||||||||||||||||||||||||||||||||||||||||||
| 37 | , [ imap4 => 'Mail::Box::IMAP4' ] | ||||||||||||||||||||||||||||||||||||||||||
| 38 | , [ imaps => 'Mail::Box::IMAP4s' ] | ||||||||||||||||||||||||||||||||||||||||||
| 39 | , [ imap4s => 'Mail::Box::IMAP4s' ] | ||||||||||||||||||||||||||||||||||||||||||
| 40 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | 14 | my @managers; # usually only one, but there may be more around :( | |||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | sub init($) | ||||||||||||||||||||||||||||||||||||||||||
| 45 | 13 | ▶ | { my ($self, $args) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=11 SCAR=29.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | 13 | $self->SUPER::init($args); | |||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | # Register all folder-types. There may be some added later. | ||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | 13 | my @new_types; | |||||||||||||||||||||||||||||||||||||||||
| 51 | 13 | ▶ | if(exists $args->{folder_types}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | { @new_types = ref $args->{folder_types}[0] | ||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | ? @{$args->{folder_types}} | |||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | ▶ | : $args->{folder_types}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 13 | my @basic_types = reverse @basic_folder_types; | |||||||||||||||||||||||||||||||||||||||||
| 58 | 13 | ▶ | if(my $basic = $args->{autodetect}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | { my %types = map +($_ => 1), ref $basic ? @$basic : $basic; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | @basic_types = grep $types{$_->[0]}, @basic_types; | |||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | 13 | $self->{MBM_folder_types} = []; | |||||||||||||||||||||||||||||||||||||||||
| 64 | 13 | $self->registerType(@$_) for @new_types, @basic_types; | |||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | 13 | ▶ | $self->{MBM_default_type} = $args->{default_folder_type} || 'mbox'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args->{'default_folder_type'} || 'mbox'
MC/DC100%1/1
$args->{'default_folder_type'} || 'mbox'
$args->{'default_folder_type'}
Truth table100%2/2
A
A= $args->{'default_folder_type'}
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | # Inventory on existing folder-directories. | ||||||||||||||||||||||||||||||||||||||||||
| 69 | 13 | my $fd = $self->{MBM_folderdirs} = [ ]; | |||||||||||||||||||||||||||||||||||||||||
| 70 | 13 | ▶ | if(exists $args->{folderdir}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | 1 | { my @dirs = $args->{folderdir}; | |||||||||||||||||||||||||||||||||||||||||
| 72 | 1 | ▶ | @dirs = @{$dirs[0]} if ref $dirs[0] eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | 1 | push @$fd, @dirs; | |||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | 13 | ▶ | if(exists $args->{folderdirs}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | { my @dirs = $args->{folderdirs}; | |||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | @dirs = @{$dirs[0]} if ref $dirs[0]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | push @$fd, @dirs; | |||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||
| 81 | 13 | push @$fd, '.'; | |||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | 13 | $self->{MBM_folders} = []; | |||||||||||||||||||||||||||||||||||||||||
| 84 | 13 | $self->{MBM_threads} = []; | |||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | 13 | push @managers, $self; | |||||||||||||||||||||||||||||||||||||||||
| 87 | 13 | weaken $managers[-1]; | |||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | 13 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | #------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | sub registerType($$@) | ||||||||||||||||||||||||||||||||||||||||||
| 95 | 143 | ▶ | { my ($self, $name, $class, @options) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
registerType: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 96 | 143 | unshift @{$self->{MBM_folder_types}}, [$name, $class, @options]; | |||||||||||||||||||||||||||||||||||||||||
| 97 | 143 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | sub folderdir() | ||||||||||||||||||||||||||||||||||||||||||
| 102 | 2 | ▶ | { my $dirs = shift->{MBM_folderdirs} or return (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
folderdir: called CC=3 SCAR=12.0
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | 2 | ▶ | wantarray ? @$dirs : $dirs->[0]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | sub folderTypes() | ||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
folderTypes: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | my %uniq; | |||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | $uniq{$_->[0]}++ foreach @{$self->{MBM_folder_types}}; | |||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | sort keys %uniq; | |||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | sub defaultFolderType() | ||||||||||||||||||||||||||||||||||||||||||
| 116 | 3 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
defaultFolderType: called CC=5 SCAR=16.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 117 | 3 | my $name = $self->{MBM_default_type}; | |||||||||||||||||||||||||||||||||||||||||
| 118 | 3 | ▶ | return $name if $name =~ m/\:\:/; # obviously a class name | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | 3 | foreach my $def (@{$self->{MBM_folder_types}}) | |||||||||||||||||||||||||||||||||||||||||
| 121 | 5 | ▶ | { return $def->[1] if $def->[0] eq $name || $def->[1] eq $name; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$def->[0] eq $name or $def->[1] eq $name
MC/DC50%1/2
$def->[0] eq $name or $def->[1] eq $name
$def->[0] eq $name
$def->[1] eq $name
Truth table66%2/3
A or B
A= $def->[0] eq $nameB= $def->[1] eq $name
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | undef; | |||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | #------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | sub open(@) | ||||||||||||||||||||||||||||||||||||||||||
| 131 | 10 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
open: called CC=63 SCAR=73.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 132 | 10 | ▶ | my $name = @_ % 2 ? shift : undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | 10 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||
| 134 | 10 | ▶ | $args{authentication} ||= 'AUTO'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{"authentication"} ||= "AUTO"
MC/DC0%0/1
$args{"authentication"} ||= "AUTO"
$args{"authentication"}
Truth table50%1/2
A
A= $args{"authentication"}
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | 10 | ▶ | $name = defined $args{folder} ? $args{folder} : ($ENV{MAIL} || '') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/2
$ENV{"MAIL"} or ""
MC/DC0%0/1
$ENV{"MAIL"} or ""
$ENV{"MAIL"}
Truth table0%0/2
A
A= $ENV{"MAIL"}
| |||||||||||||||||||||||||||||||||||||||||||
| 137 | unless defined $name; | ||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | 10 | ▶ | if($name =~ m/^(\w+)\:/ && grep $_ eq $1, $self->folderTypes) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$name =~ /^(\w+)\:/ and grep(($_ eq $1), $self->folderTypes)
MC/DC0%0/2
$name =~ /^(\w+)\:/ and grep(($_ eq $1), $self->folderTypes)
$name =~ /^(\w+)\:/
grep(($_ eq $1), $self->folderTypes)
Truth table33%1/3
A and B
A= $name =~ /^(\w+)\:/B= grep(($_ eq $1), $self->folderTypes)
| |||||||||||||||||||||||||||||||||||||||||||
| 140 | { # Complicated folder URL | ||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | my %decoded = $self->decodeFolderURL($name); | |||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | if(keys %decoded) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 143 | { # accept decoded info | ||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | @args{keys %decoded} = values %decoded; | |||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||
| 146 | else | ||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | { $self->log(ERROR => "Illegal folder URL '$name'."); | |||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||
| 151 | else | ||||||||||||||||||||||||||||||||||||||||||
| 152 | { # Simple folder name | ||||||||||||||||||||||||||||||||||||||||||
| 153 | 10 | $args{folder} = $name; | |||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||
| 156 | # Do not show password in folder name | ||||||||||||||||||||||||||||||||||||||||||
| 157 | 10 | my $type = $args{type}; | |||||||||||||||||||||||||||||||||||||||||
| 158 | 10 | ▶ | if(!defined $type) { ; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 159 | ▶ | elsif($type eq 'pop3' || $type eq 'pop') | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$type eq "pop3" or $type eq "pop"
MC/DC0%0/2
$type eq "pop3" or $type eq "pop"
$type eq "pop3"
$type eq "pop"
Truth table0%0/3
A or B
A= $type eq "pop3"B= $type eq "pop"
| |||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | ▶ | { my $un = $args{username} ||= $ENV{USER} || $ENV{LOGIN}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$args{"username"} ||= $ENV{"USER"} || $ENV{"LOGIN"}
$ENV{'USER'} || $ENV{'LOGIN'}
MC/DC0%0/3
$args{"username"} ||= $ENV{"USER"} || $ENV{"LOGIN"}
$args{"username"}
$ENV{'USER'}
$ENV{'LOGIN'}
Truth table0%0/4
A ||= B || C
A= $args{"username"}B= $ENV{'USER'}C= $ENV{'LOGIN'}
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | my $srv = $args{server_name} ||= 'localhost'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$args{"server_name"} ||= "localhost"
MC/DC0%0/1
$args{"server_name"} ||= "localhost"
$args{"server_name"}
Truth table0%0/2
A
A= $args{"server_name"}
| |||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | my $port = $args{server_port} ||= 110; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$args{"server_port"} ||= 110
MC/DC0%0/1
$args{"server_port"} ||= 110
$args{"server_port"}
Truth table0%0/2
A
A= $args{"server_port"}
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | $args{folderdir} = $name = "pop3://$un\@$srv:$port"; | |||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||
| 165 | ▶ | elsif($type eq 'pop3s' || $type eq 'pops') | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$type eq "pop3s" or $type eq "pops"
MC/DC0%0/2
$type eq "pop3s" or $type eq "pops"
$type eq "pop3s"
$type eq "pops"
Truth table0%0/3
A or B
A= $type eq "pop3s"B= $type eq "pops"
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | { my $un = $args{username} ||= $ENV{USER} || $ENV{LOGIN}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$args{"username"} ||= $ENV{"USER"} || $ENV{"LOGIN"}
$ENV{'USER'} || $ENV{'LOGIN'}
MC/DC0%0/3
$args{"username"} ||= $ENV{"USER"} || $ENV{"LOGIN"}
$args{"username"}
$ENV{'USER'}
$ENV{'LOGIN'}
Truth table0%0/4
A ||= B || C
A= $args{"username"}B= $ENV{'USER'}C= $ENV{'LOGIN'}
| |||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | my $srv = $args{server_name} ||= 'localhost'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$args{"server_name"} ||= "localhost"
MC/DC0%0/1
$args{"server_name"} ||= "localhost"
$args{"server_name"}
Truth table0%0/2
A
A= $args{"server_name"}
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | my $port = $args{server_port} ||= 995; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$args{"server_port"} ||= 995
MC/DC0%0/1
$args{"server_port"} ||= 995
$args{"server_port"}
Truth table0%0/2
A
A= $args{"server_port"}
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | $args{folderdir} = $name = "pop3s://$un\@$srv:$port"; | |||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 171 | ▶ | elsif($type eq 'imap4' || $type eq 'imap') | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$type eq "imap4" or $type eq "imap"
MC/DC0%0/2
$type eq "imap4" or $type eq "imap"
$type eq "imap4"
$type eq "imap"
Truth table0%0/3
A or B
A= $type eq "imap4"B= $type eq "imap"
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | { my $un = $args{username} ||= $ENV{USER} || $ENV{LOGIN}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$args{"username"} ||= $ENV{"USER"} || $ENV{"LOGIN"}
$ENV{'USER'} || $ENV{'LOGIN'}
MC/DC0%0/3
$args{"username"} ||= $ENV{"USER"} || $ENV{"LOGIN"}
$args{"username"}
$ENV{'USER'}
$ENV{'LOGIN'}
Truth table0%0/4
A ||= B || C
A= $args{"username"}B= $ENV{'USER'}C= $ENV{'LOGIN'}
| |||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | my $srv = $args{server_name} ||= 'localhost'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$args{"server_name"} ||= "localhost"
MC/DC0%0/1
$args{"server_name"} ||= "localhost"
$args{"server_name"}
Truth table0%0/2
A
A= $args{"server_name"}
| |||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | ▶ | my $port = $args{server_port} ||= 143; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$args{"server_port"} ||= 143
MC/DC0%0/1
$args{"server_port"} ||= 143
$args{"server_port"}
Truth table0%0/2
A
A= $args{"server_port"}
| |||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | $args{folderdir} = $name = "imap4://$un\@$srv:$port"; | |||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||
| 177 | ▶ | elsif($type eq 'imap4s' || $type eq 'imaps') | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$type eq "imap4s" or $type eq "imaps"
MC/DC0%0/2
$type eq "imap4s" or $type eq "imaps"
$type eq "imap4s"
$type eq "imaps"
Truth table0%0/3
A or B
A= $type eq "imap4s"B= $type eq "imaps"
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | ▶ | { my $un = $args{username} ||= $ENV{USER} || $ENV{LOGIN}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$args{"username"} ||= $ENV{"USER"} || $ENV{"LOGIN"}
$ENV{'USER'} || $ENV{'LOGIN'}
MC/DC0%0/3
$args{"username"} ||= $ENV{"USER"} || $ENV{"LOGIN"}
$args{"username"}
$ENV{'USER'}
$ENV{'LOGIN'}
Truth table0%0/4
A ||= B || C
A= $args{"username"}B= $ENV{'USER'}C= $ENV{'LOGIN'}
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | ▶ | my $srv = $args{server_name} ||= 'localhost'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$args{"server_name"} ||= "localhost"
MC/DC0%0/1
$args{"server_name"} ||= "localhost"
$args{"server_name"}
Truth table0%0/2
A
A= $args{"server_name"}
| |||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | ▶ | my $port = $args{server_port} ||= 993; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$args{"server_port"} ||= 993
MC/DC0%0/1
$args{"server_port"} ||= 993
$args{"server_port"}
Truth table0%0/2
A
A= $args{"server_port"}
| |||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | $args{folderdir} = $name = "imap4s://$un\@$srv:$port"; | |||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||
| 184 | 10 | ▶ | unless(defined $name && length $name) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $name and length $name
MC/DC0%0/2
defined $name and length $name
defined $name
length $name
Truth table33%1/3
A and B
A= defined $nameB= length $name
| |||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | { $self->log(ERROR => "No foldername specified to open."); | |||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | $args{folderdir} ||= $self->{MBM_folderdirs}->[0] | ||||||||||||||||||||||||||||||||||||||||||
| 190 | 10 | ▶ | if $self->{MBM_folderdirs}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$args{"folderdir"} ||= $self->{"MBM_folderdirs"}[0]
MC/DC0%0/2
$args{"folderdir"} ||= $self->{"MBM_folderdirs"}[0]
$args{"folderdir"}
$self->{"MBM_folderdirs"}[0]
Truth table66%2/3
A ||= B
A= $args{"folderdir"}B= $self->{"MBM_folderdirs"}[0]
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||
| 192 | 10 | ▶ | $args{access} ||= 'r'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{"access"} ||= "r"
MC/DC100%1/1
$args{"access"} ||= "r"
$args{"access"}
Truth table100%2/2
A
A= $args{"access"}
| |||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||
| 194 | 10 | ▶ | if($args{create} && $args{access} !~ m/w|a/) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$args{"create"} and not $args{"access"} =~ /w|a/
MC/DC0%0/2
$args{"create"} and not $args{"access"} =~ /w|a/
$args{"create"}
not $args{"access"} =~ /w|a/
Truth table33%1/3
A and not(B)
A= $args{"create"}B= not $args{"access"} =~ /w|a/
| |||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | { $self->log(WARNING | |||||||||||||||||||||||||||||||||||||||||
| 196 | => "Will never create a folder $name without having write access."); | ||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | undef $args{create}; | |||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||
| 200 | # Do not open twice. | ||||||||||||||||||||||||||||||||||||||||||
| 201 | 10 | ▶ | if(my $folder = $self->isOpenFolder($name)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | { $self->log(ERROR => "Folder $name is already open."); | |||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||
| 206 | # | ||||||||||||||||||||||||||||||||||||||||||
| 207 | # Which folder type do we need? | ||||||||||||||||||||||||||||||||||||||||||
| 208 | # | ||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | 10 | my ($folder_type, $class, @defaults); | |||||||||||||||||||||||||||||||||||||||||
| 211 | 10 | ▶ | if($type) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 212 | { # User-specified foldertype prevails. | ||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | foreach (@{$self->{MBM_folder_types}}) | |||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | { (my $abbrev, $class, @defaults) = @$_; | |||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | if($type eq $abbrev || $type eq $class) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$type eq $abbrev or $type eq $class
MC/DC0%0/2
$type eq $abbrev or $type eq $class
$type eq $abbrev
$type eq $class
Truth table0%0/3
A or B
A= $type eq $abbrevB= $type eq $class
| |||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | { $folder_type = $abbrev; | |||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | ▶ | $self->log(ERROR => "Folder type $type is unknown, using autodetect.") | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 223 | unless $folder_type; | ||||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||
| 226 | 10 | ▶ | unless($folder_type) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 227 | { # Try to autodetect foldertype. | ||||||||||||||||||||||||||||||||||||||||||
| 228 | 10 | foreach (@{$self->{MBM_folder_types}}) | |||||||||||||||||||||||||||||||||||||||||
| 229 | 15 | ▶ | { next unless $_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 230 | 15 | (my $abbrev, $class, @defaults) = @$_; | |||||||||||||||||||||||||||||||||||||||||
| 231 | 15 | ▶ | next if $require_failed{$class}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||
| 233 | 15 | eval "require $class"; | |||||||||||||||||||||||||||||||||||||||||
| 234 | 15 | ▶ | if($@) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | { $require_failed{$class}++; | |||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||
| 239 | 15 | ▶ | if($class->foundIn($name, @defaults, %args)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 240 | 10 | { $folder_type = $abbrev; | |||||||||||||||||||||||||||||||||||||||||
| 241 | 10 | last; | |||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||
| 246 | 10 | ▶ | unless($folder_type) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 247 | { # Use specified default | ||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | ▶ | if(my $type = $self->{MBM_default_type}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | { foreach (@{$self->{MBM_folder_types}}) | |||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | { (my $abbrev, $class, @defaults) = @$_; | |||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | ▶ | if($type eq $abbrev || $type eq $class) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$type eq $abbrev or $type eq $class
MC/DC0%0/2
$type eq $abbrev or $type eq $class
$type eq $abbrev
$type eq $class
Truth table0%0/3
A or B
A= $type eq $abbrevB= $type eq $class
| |||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | { $folder_type = $abbrev; | |||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||
| 259 | 10 | ▶ | unless($folder_type) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 260 | { # use first type (last defined) | ||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | ($folder_type, $class, @defaults) = @{$self->{MBM_folder_types}[0]}; | |||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||
| 264 | # | ||||||||||||||||||||||||||||||||||||||||||
| 265 | # Try to open the folder | ||||||||||||||||||||||||||||||||||||||||||
| 266 | # | ||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||
| 268 | 10 | ▶ | return if $require_failed{$class}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 269 | 10 | eval "require $class"; | |||||||||||||||||||||||||||||||||||||||||
| 270 | 10 | ▶ | if($@) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | { $self->log(ERROR => "Failed for folder default $class: $@"); | |||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | $require_failed{$class}++; | |||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | return (); | |||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||
| 276 | 10 | push @defaults, manager => $self; | |||||||||||||||||||||||||||||||||||||||||
| 277 | 10 | my $folder = $class->new(@defaults, %args); | |||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | ▶ | unless(defined $folder) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 279 | { $self->log(WARNING => | ||||||||||||||||||||||||||||||||||||||||||
| 280 | "Folder does not exist, failed opening $folder_type folder $name.") | ||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | ▶ | unless $args{access} eq 'd'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | $self->log(PROGRESS => "Opened folder $name ($folder_type)."); | |||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | push @{$self->{MBM_folders}}, $folder; | |||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | $folder; | |||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||
| 291 | 22 | ▶ | sub openFolders() { @{shift->{MBM_folders}} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
openFolders: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||
| 294 | sub isOpenFolder($) | ||||||||||||||||||||||||||||||||||||||||||
| 295 | 10 | ▶ | { my ($self, $name) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
isOpenFolder: called CC=1 SCAR=0.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 296 | 10 | ▶ | first {$name eq $_->name} $self->openFolders; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||
| 299 | #------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||
| 302 | sub close($@) | ||||||||||||||||||||||||||||||||||||||||||
| 303 | 10 | ▶ | { my ($self, $folder, %options) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
close: called CC=5 SCAR=21.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 304 | 10 | ▶ | return unless $folder; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||
| 306 | 10 | my $name = $folder->name; | |||||||||||||||||||||||||||||||||||||||||
| 307 | 10 | my @remaining = grep {$name ne $_->name} @{$self->{MBM_folders}}; | |||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||
| 309 | # folder opening failed: | ||||||||||||||||||||||||||||||||||||||||||
| 310 | 10 | ▶ | return if @{$self->{MBM_folders}} == @remaining; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | $self->{MBM_folders} = [ @remaining ]; | |||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | $_->removeFolder($folder) foreach @{$self->{MBM_threads}}; | |||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||
| 315 | $folder->close(close_by_manager => 1, %options) | ||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | ▶ | unless $options{close_by_self}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||
| 321 | #------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||
| 324 | sub closeAllFolders(@) | ||||||||||||||||||||||||||||||||||||||||||
| 325 | 12 | ▶ | { my ($self, @options) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
closeAllFolders: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 326 | 12 | $_->close(@options) for $self->openFolders; | |||||||||||||||||||||||||||||||||||||||||
| 327 | 12 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||
| 330 | 14 | ▶ | END { map defined $_ && $_->closeAllFolders, @managers } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
END: called CC=2 SCAR=7.2
Condition66%2/3
defined $_ && $_->closeAllFolders
MC/DC50%1/2
defined $_ && $_->closeAllFolders
defined $_
$_->closeAllFolders
Truth table66%2/3
A && B
A= defined $_B= $_->closeAllFolders
| |||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||
| 332 | #------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||
| 334 | sub delete($@) | ||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | ▶ | { my ($self, $name, %args) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | my $recurse = delete $args{recursive}; | |||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | ▶ | my $folder = $self->open(folder => $name, access => 'd', %args) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 339 | or return $self; # still successful | ||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | $folder->delete(recursive => $recurse); | |||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||
| 344 | #------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||
| 346 | sub appendMessage(@) | ||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
appendMessage: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | my @appended = $self->appendMessages(@_); | |||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | ▶ | wantarray ? @appended : $appended[0]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||
| 352 | sub appendMessages(@) | ||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
appendMessages: not called CC=23 SCAR=63.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | my $folder; | |||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | ▶ | $folder = shift if !ref $_[0] || $_[0]->isa('Mail::Box'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not ref $_[0] or $_[0]->isa("Mail::Box")
MC/DC0%0/2
not ref $_[0] or $_[0]->isa("Mail::Box")
not ref $_[0]
$_[0]->isa("Mail::Box")
Truth table0%0/3
not(A) or B
A= not ref $_[0]B= $_[0]->isa("Mail::Box")
| |||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | my @messages; | |||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | ▶ | push @messages, shift while @_ && ref $_[0]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@_ and ref $_[0]
MC/DC0%0/2
@_ and ref $_[0]
@_
ref $_[0]
Truth table0%0/3
A and B
A= @_B= ref $_[0]
| |||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | my %options = @_; | |||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | ▶ | $folder ||= $options{folder}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$folder ||= $options{"folder"}
MC/DC0%0/2
$folder ||= $options{"folder"}
$folder
$options{"folder"}
Truth table0%0/3
A ||= B
A= $folderB= $options{"folder"}
| |||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||
| 363 | # Try to resolve filenames into opened-files. | ||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | ▶ | $folder = $self->isOpenFolder($folder) || $folder | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->isOpenFolder($folder) || $folder
MC/DC0%0/2
$self->isOpenFolder($folder) || $folder
$self->isOpenFolder($folder)
$folder
Truth table0%0/3
A || B
A= $self->isOpenFolder($folder)B= $folder
| |||||||||||||||||||||||||||||||||||||||||||
| 365 | unless ref $folder; | ||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | ▶ | if(ref $folder) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 368 | { # An open file. | ||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | ▶ | unless($folder->isa('Mail::Box')) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | { $self->log(ERROR => | |||||||||||||||||||||||||||||||||||||||||
| 371 | "Folder $folder is not a Mail::Box; cannot add a message.\n"); | ||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | return (); | |||||||||||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | foreach (@messages) | |||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | ▶ | { next unless $_->isa('Mail::Box::Message') && $_->folder; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$_->isa("Mail::Box::Message") and $_->folder
MC/DC0%0/2
$_->isa("Mail::Box::Message") and $_->folder
$_->isa("Mail::Box::Message")
$_->folder
Truth table0%0/3
A and B
A= $_->isa("Mail::Box::Message")B= $_->folder
| |||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | $self->log(WARNING => | |||||||||||||||||||||||||||||||||||||||||
| 378 | "Use moveMessage() or copyMessage() to move between open folders."); | ||||||||||||||||||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | return $folder->addMessages(@messages); | |||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||
| 384 | # Not an open file. | ||||||||||||||||||||||||||||||||||||||||||
| 385 | # Try to autodetect the folder-type and then add the message. | ||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | my ($name, $class, @gen_options, $found); | |||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | foreach (@{$self->{MBM_folder_types}}) | |||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | { ($name, $class, @gen_options) = @$_; | |||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | ▶ | next if $require_failed{$class}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | eval "require $class"; | |||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | ▶ | if($@) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | { $require_failed{$class}++; | |||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | ▶ | if($class->foundIn($folder, @gen_options, access => 'a')) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | { $found++; | |||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||
| 404 | # The folder was not found at all, so we take the default folder-type. | ||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | my $type = $self->{MBM_default_type}; | |||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | ▶ | if(!$found && $type) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $found and $type
MC/DC0%0/2
not $found and $type
not $found
$type
Truth table0%0/3
not(A) and B
A= not $foundB= $type
| |||||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | { foreach (@{$self->{MBM_folder_types}}) | |||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | { ($name, $class, @gen_options) = @$_; | |||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | ▶ | if($type eq $name || $type eq $class) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$type eq $name or $type eq $class
MC/DC0%0/2
$type eq $name or $type eq $class
$type eq $name
$type eq $class
Truth table0%0/3
A or B
A= $type eq $nameB= $type eq $class
| |||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | { $found++; | |||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||
| 416 | # Even the default foldertype was not found (or nor defined). | ||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | ▶ | ($name, $class, @gen_options) = @{$self->{MBM_folder_types}[0]} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 418 | unless $found; | ||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | $class->appendMessages | |||||||||||||||||||||||||||||||||||||||||
| 421 | ( type => $name | ||||||||||||||||||||||||||||||||||||||||||
| 422 | , messages => \@messages | ||||||||||||||||||||||||||||||||||||||||||
| 423 | , @gen_options | ||||||||||||||||||||||||||||||||||||||||||
| 424 | , %options | ||||||||||||||||||||||||||||||||||||||||||
| 425 | , folder => $folder | ||||||||||||||||||||||||||||||||||||||||||
| 426 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 427 | } | ||||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||
| 431 | sub copyMessage(@) | ||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
copyMessage: not called CC=16 SCAR=56.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | my $folder; | |||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | ▶ | $folder = shift if !ref $_[0] || $_[0]->isa('Mail::Box'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not ref $_[0] or $_[0]->isa("Mail::Box")
MC/DC0%0/2
not ref $_[0] or $_[0]->isa("Mail::Box")
not ref $_[0]
$_[0]->isa("Mail::Box")
Truth table0%0/3
not(A) or B
A= not ref $_[0]B= $_[0]->isa("Mail::Box")
| |||||||||||||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | my @messages; | |||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | ▶ | while(@_ && ref $_[0]) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@_ and ref $_[0]
MC/DC0%0/2
@_ and ref $_[0]
@_
ref $_[0]
Truth table0%0/3
A and B
A= @_B= ref $_[0]
| |||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | { my $message = shift; | |||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | ▶ | $self->log(ERROR => | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 440 | "Use appendMessage() to add messages which are not in a folder.") | ||||||||||||||||||||||||||||||||||||||||||
| 441 | unless $message->isa('Mail::Box::Message'); | ||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | push @messages, $message; | |||||||||||||||||||||||||||||||||||||||||
| 443 | } | ||||||||||||||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | ▶ | $folder ||= $args{folder}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$folder ||= $args{"folder"}
MC/DC0%0/2
$folder ||= $args{"folder"}
$folder
$args{"folder"}
Truth table0%0/3
A ||= B
A= $folderB= $args{"folder"}
| |||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | ▶ | my $share = exists $args{share} ? $args{share} : $args{_delete}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||
| 449 | # Try to resolve filenames into opened-files. | ||||||||||||||||||||||||||||||||||||||||||
| 450 | 0 | ▶ | $folder = $self->isOpenFolder($folder) || $folder | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->isOpenFolder($folder) || $folder
MC/DC0%0/2
$self->isOpenFolder($folder) || $folder
$self->isOpenFolder($folder)
$folder
Truth table0%0/3
A || B
A= $self->isOpenFolder($folder)B= $folder
| |||||||||||||||||||||||||||||||||||||||||||
| 451 | unless ref $folder; | ||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||
| 453 | 0 | ▶ | unless(ref $folder) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | { my @c = $self->appendMessages(@messages, %args, folder => $folder); | |||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | ▶ | if($args{_delete}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | { $_->label(deleted => 1) for @messages; | |||||||||||||||||||||||||||||||||||||||||
| 457 | } | ||||||||||||||||||||||||||||||||||||||||||
| 458 | 0 | return @c; | |||||||||||||||||||||||||||||||||||||||||
| 459 | } | ||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | my @coerced; | |||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | foreach my $msg (@messages) | |||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | ▶ | { if($msg->folder eq $folder) # ignore move to same folder | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | { push @coerced, $msg; | |||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 466 | } | ||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | push @coerced, $msg->copyTo($folder, share => $args{share}); | |||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | ▶ | $msg->label(deleted => 1) if $args{_delete}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 469 | } | ||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | @coerced; | |||||||||||||||||||||||||||||||||||||||||
| 471 | } | ||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||
| 475 | sub moveMessage(@) | ||||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
moveMessage: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | $self->copyMessage(@_, _delete => 1); | |||||||||||||||||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||
| 480 | #------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||
| 482 | sub threads(@) | ||||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
threads: not called CC=14 SCAR=53.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | my @folders; | |||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | ▶ | push @folders, shift | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
@_ and ref $_[0] and $_[0]->isa("Mail::Box")
@_ and ref $_[0]
MC/DC0%0/3
@_ and ref $_[0] and $_[0]->isa("Mail::Box")
@_
ref $_[0]
$_[0]->isa("Mail::Box")
Truth table0%0/4
A and B and C
A= @_B= ref $_[0]C= $_[0]->isa("Mail::Box")
| |||||||||||||||||||||||||||||||||||||||||||
| 486 | while @_ && ref $_[0] && $_[0]->isa('Mail::Box'); | ||||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | my $base = 'Mail::Box::Thread::Manager'; | |||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | ▶ | my $type = $args{threader_type} || $base; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$args{'threader_type'} || $base
MC/DC0%0/2
$args{'threader_type'} || $base
$args{'threader_type'}
$base
Truth table0%0/3
A || B
A= $args{'threader_type'}B= $base
| |||||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | ▶ | my $folders = delete $args{folder} || delete $args{folders}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
delete $args{'folder'} || delete $args{'folders'}
MC/DC0%0/2
delete $args{'folder'} || delete $args{'folders'}
delete $args{'folder'}
delete $args{'folders'}
Truth table0%0/3
A || B
A= delete $args{'folder'}B= delete $args{'folders'}
| |||||||||||||||||||||||||||||||||||||||||||
| 493 | 0 | ▶ | push @folders | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 494 | , ( !$folders ? () | ||||||||||||||||||||||||||||||||||||||||||
| 495 | : ref $folders eq 'ARRAY' ? @$folders | ||||||||||||||||||||||||||||||||||||||||||
| 496 | : $folders | ||||||||||||||||||||||||||||||||||||||||||
| 497 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | ▶ | $self->log(INTERNAL => "No folders specified.") | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 500 | unless @folders; | ||||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||
| 502 | 0 | my $threads; | |||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | ▶ | if(ref $type) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 504 | { # Already prepared object. | ||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | ▶ | $self->log(INTERNAL => "You need to pass a $base derived") | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 506 | unless $type->isa($base); | ||||||||||||||||||||||||||||||||||||||||||
| 507 | 0 | $threads = $type; | |||||||||||||||||||||||||||||||||||||||||
| 508 | } | ||||||||||||||||||||||||||||||||||||||||||
| 509 | else | ||||||||||||||||||||||||||||||||||||||||||
| 510 | { # Create an object. The code is compiled, which safes us the | ||||||||||||||||||||||||||||||||||||||||||
| 511 | # need to compile Mail::Box::Thread::Manager when no threads are needed. | ||||||||||||||||||||||||||||||||||||||||||
| 512 | 0 | eval "require $type"; | |||||||||||||||||||||||||||||||||||||||||
| 513 | 0 | ▶ | $self->log(INTERNAL => "Unusable threader $type: $@") if $@; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | ▶ | $self->log(INTERNAL => "You need to pass a $base derived") | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 516 | unless $type->isa($base); | ||||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | $threads = $type->new(manager => $self, %args); | |||||||||||||||||||||||||||||||||||||||||
| 519 | } | ||||||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||||||
| 521 | 0 | $threads->includeFolder($_) foreach @folders; | |||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | push @{$self->{MBM_threads}}, $threads; | |||||||||||||||||||||||||||||||||||||||||
| 523 | 0 | $threads; | |||||||||||||||||||||||||||||||||||||||||
| 524 | } | ||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||
| 526 | #------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||
| 528 | sub toBeThreaded($@) | ||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
toBeThreaded: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | $_->toBeThreaded(@_) foreach @{$self->{MBM_threads}}; | |||||||||||||||||||||||||||||||||||||||||
| 531 | } | ||||||||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||||||
| 534 | sub toBeUnthreaded($@) | ||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
toBeUnthreaded: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | $_->toBeUnthreaded(@_) foreach @{$self->{MBM_threads}}; | |||||||||||||||||||||||||||||||||||||||||
| 537 | } | ||||||||||||||||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||
| 540 | sub decodeFolderURL($) | ||||||||||||||||||||||||||||||||||||||||||
| 541 | 16 | ▶ | { my ($self, $name) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
decodeFolderURL: called CC=8 SCAR=21.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||
| 543 | return unless | ||||||||||||||||||||||||||||||||||||||||||
| 544 | 16 | ▶ | my ($type, $username, $password, $hostname, $port, $path) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 545 | = $name =~ m!^(\w+)\: # protocol | ||||||||||||||||||||||||||||||||||||||||||
| 546 | (?:// | ||||||||||||||||||||||||||||||||||||||||||
| 547 | (?:([^:@/]*) # username | ||||||||||||||||||||||||||||||||||||||||||
| 548 | (?:\:([^@/]*))? # password | ||||||||||||||||||||||||||||||||||||||||||
| 549 | \@)? | ||||||||||||||||||||||||||||||||||||||||||
| 550 | ([\w.-]+)? # hostname | ||||||||||||||||||||||||||||||||||||||||||
| 551 | (?:\:(\d+))? # port number | ||||||||||||||||||||||||||||||||||||||||||
| 552 | )? | ||||||||||||||||||||||||||||||||||||||||||
| 553 | (.*) # foldername | ||||||||||||||||||||||||||||||||||||||||||
| 554 | !x; | ||||||||||||||||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||||||||||||||||
| 556 | 15 | ▶ | $username ||= $ENV{USER} || $ENV{LOGNAME}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%3/6
$username ||= $ENV{"USER"} || $ENV{"LOGNAME"}
$ENV{'USER'} || $ENV{'LOGNAME'}
MC/DC0%0/3
$username ||= $ENV{"USER"} || $ENV{"LOGNAME"}
$username
$ENV{'USER'}
$ENV{'LOGNAME'}
Truth table0%0/4
A ||= B || C
A= $usernameB= $ENV{'USER'}C= $ENV{'LOGNAME'}
| |||||||||||||||||||||||||||||||||||||||||||
| 557 | 15 | ▶ | $password ||= ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$password ||= ""
MC/DC100%1/1
$password ||= ""
$password
Truth table100%2/2
A
A= $password
| |||||||||||||||||||||||||||||||||||||||||||
| 558 | |||||||||||||||||||||||||||||||||||||||||||
| 559 | 15 | for($username, $password) | |||||||||||||||||||||||||||||||||||||||||
| 560 | 30 | { s/\+/ /g; | |||||||||||||||||||||||||||||||||||||||||
| 561 | 30 | s/\%([A-Fa-f0-9]{2})/chr hex $1/ge; | |||||||||||||||||||||||||||||||||||||||||
| 562 | } | ||||||||||||||||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||||||||||||||||
| 564 | 15 | ▶ | $hostname ||= 'localhost'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$hostname ||= "localhost"
MC/DC100%1/1
$hostname ||= "localhost"
$hostname
Truth table100%2/2
A
A= $hostname
| |||||||||||||||||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||||||||||||||||
| 566 | 15 | ▶ | $path ||= '='; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$path ||= "="
MC/DC100%1/1
$path ||= "="
$path
Truth table100%2/2
A
A= $path
| |||||||||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||||||||
| 568 | 15 | ( type => $type, folder => $path | |||||||||||||||||||||||||||||||||||||||||
| 569 | , username => $username, password => $password | ||||||||||||||||||||||||||||||||||||||||||
| 570 | , server_name => $hostname, server_port => $port | ||||||||||||||||||||||||||||||||||||||||||
| 571 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 572 | } | ||||||||||||||||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||||||||||||||||
| 574 | #------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||||||||||
| 576 | 14 | 1; | |||||||||||||||||||||||||||||||||||||||||