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