Box/Net.pm

filter: Statementstmt 52.1% 36 / 69 Branchbran 0.0% 0 / 16 Conditioncond 0.0% 0 / 23 MC/DCmcdc 0.0% 0 / 13 Subroutinesub 78.5% 11 / 14 Podpod 66.6% 2 / 3 totaltotal 35.5% 49 / 138 CC 19 SCAR 46.1
CC
19
Cov
33%
init
210.0
url
42.0
create
2.0
CRAP 100.2
« Box/Manager.pm ↑ Summary Box/Maildir.pm »
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::Net;{
13 2 our $VERSION = '4.02';
14 }
15  
16 2 ▶use parent 'Mail::Box';
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 2 ▶use Log::Report 'mail-box', import => [ qw/__x warning/ ];
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 2 ▶use Mail::Box::Net::Message ();
Subroutine BEGIN: called CC=1 SCAR=0.0
24 2 ▶use Mail::Message::Body::Lines ();
Subroutine BEGIN: called CC=1 SCAR=0.0
25 2 ▶use Mail::Message::Body::File ();
Subroutine BEGIN: called CC=1 SCAR=0.0
26 2 ▶use Mail::Message::Body::Delayed ();
Subroutine BEGIN: called CC=1 SCAR=0.0
27 2 ▶use Mail::Message::Body::Multipart ();
Subroutine BEGIN: called CC=1 SCAR=0.0
28 2 ▶use Mail::Message::Head ();
Subroutine BEGIN: called CC=1 SCAR=0.0
29 2 ▶use Mail::Message::Head::Delayed ();
Subroutine BEGIN: called CC=1 SCAR=0.0
30  
31 #--------------------
32  
33 sub init($)
34 0 ▶{ my ($self, $args) = @_;
Subroutine init: not called CC=14 SCAR=53.5
Pod undocumented
35  
36 0 ▶ $args->{lock_type} ||= 'NONE';
Condition0%0/2
$args->{"lock_type"} ||= "NONE"
l!l
00
MC/DC0%0/1
$args->{"lock_type"} ||= "NONE"
$args->{"lock_type"}
Truth table0%0/2
A
A= $args->{"lock_type"}
Aresult
11
00
37 0 ▶ $args->{body_type} ||= 'Mail::Message::Body::Lines';
Condition0%0/2
$args->{"body_type"} ||= "Mail::Message::Body::Lines"
l!l
00
MC/DC0%0/1
$args->{"body_type"} ||= "Mail::Message::Body::Lines"
$args->{"body_type"}
Truth table0%0/2
A
A= $args->{"body_type"}
Aresult
11
00
38 0 ▶ $args->{trusted} ||= 0;
Condition0%0/2
$args->{"trusted"} ||= 0
l!l
00
MC/DC0%0/1
$args->{"trusted"} ||= 0
$args->{"trusted"}
Truth table0%0/2
A
A= $args->{"trusted"}
Aresult
11
00
39  
40 0 my ($scheme, $s, $port, $u, $pwd, $f);
41 0 ▶ if(my $d = $args->{folderdir})
Branch: 1 branch
BranchTrueFalseTotal
if (my $d = $args->{"folderdir"}) 0 0 0
42 { # cannot use URI, because some scheme's are fake
43 0 ($scheme, $u, $pwd, $s, $port, $f) = $d =~ m!
44 ^ (\w+) \:// # scheme
45 (?: ( [^:\@/]+ ) # username
46 (?: \: ( [^\@/]+ ))? # password
47 \@ )?
48 ( [a-zA-Z0-9.-]+ )? # hostname
49 (?: \: ([0-9]+) )? # port
50 ( / .* )? # path
51 !x;
52  
53 0 defined && s/%([0-9a-fA-F]{2})/hex $1/ge
54 0 ▶ for $u, $pwd, $s, $port, $f;
Branch: 1 branch
BranchTrueFalseTotal
defined $_ and s/%([0-9a-fA-F]{2})/hex $1;/eg 0 0 0
55  
56 0 $args->{folderdir} =~ s!/$!!;
57 }
58  
59 0 ▶ $args->{folder} ||= $f || '/';
Condition0%0/5
$args->{"folder"} ||= $f || "/"
l!l&&r!l&&!r
000
$f || '/'
l!l
00
MC/DC0%0/2
$args->{"folder"} ||= $f || "/"
$args->{"folder"} $f
Truth table0%0/3
A ||= B
A= $args->{"folder"}B= $f
ABresult
1X1
011
000
60  
61 0 $self->SUPER::init($args);
62  
63 0 ▶ $self->{MBN_hostname} = $args->{server_name} || $s;
Condition0%0/3
$args->{'server_name'} || $s
l!l&&r!l&&!r
000
MC/DC0%0/2
$args->{'server_name'} || $s
$args->{'server_name'} $s
Truth table0%0/3
A || B
A= $args->{'server_name'}B= $s
ABresult
1X1
011
000
64 0 ▶ $self->{MBN_port} = $args->{server_port} || $port;
Condition0%0/3
$args->{'server_port'} || $port
l!l&&r!l&&!r
000
MC/DC0%0/2
$args->{'server_port'} || $port
$args->{'server_port'} $port
Truth table0%0/3
A || B
A= $args->{'server_port'}B= $port
ABresult
1X1
011
000
65 0 ▶ $self->{MBN_username} = $args->{username} || $u;
Condition0%0/3
$args->{'username'} || $u
l!l&&r!l&&!r
000
MC/DC0%0/2
$args->{'username'} || $u
$args->{'username'} $u
Truth table0%0/3
A || B
A= $args->{'username'}B= $u
ABresult
1X1
011
000
66 0 ▶ $self->{MBN_password} = $args->{password} || $pwd;
Condition0%0/3
$args->{'password'} || $pwd
l!l&&r!l&&!r
000
MC/DC0%0/2
$args->{'password'} || $pwd
$args->{'password'} $pwd
Truth table0%0/3
A || B
A= $args->{'password'}B= $pwd
ABresult
1X1
011
000
67  
68 ! exists $args->{hostname}
69 0 ▶ or warning __x"the term 'hostname' is confusing wrt folder. You probably need 'server_name'.";
Branch: 1 branch
BranchTrueFalseTotal
exists $args->{"hostname"} and &warning(&__x("the term 'hostname' is confusing wrt folder. You probably need 'server_name'.")) 0 0 0
70  
71 0 $self;
72 }
73  
74  
75 0 ▶sub create(@) { $_[0]->notImplemented }
Subroutine create: not called CC=1 SCAR=6.9
Pod documented
76 sub organization() { 'REMOTE' }
77  
78 sub url()
79 0 ▶{ my $self = shift;
Subroutine url: not called CC=6 SCAR=37.4
Pod documented
80 0 my ($user, $pass, $host, $port) = @$self{ qw/MBN_username MBN_password MBN_hostname MBN_port/ };
81  
82 0 my $perm = '';
83 0 ▶ $perm = $user if defined $user;
Branch: 1 branch
BranchTrueFalseTotal
if defined $user 0 0 0
84 0 ▶ if(defined $pass)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $pass) 0 0 0
85 0 { $pass =~ s/(\W)/sprintf "%%%02X", ord $1/ge;
86 0 $perm .= ':'.$pass;
87 }
88  
89 0 ▶ $perm .= '@' if length $perm;
Branch: 1 branch
BranchTrueFalseTotal
if length $perm 0 0 0
90  
91 0 my $loc = $host;
92 0 ▶ $loc .= ':'.$port if length $port;
Branch: 1 branch
BranchTrueFalseTotal
if length $port 0 0 0
93  
94 0 my $name = $self->name;
95 0 ▶ $loc .= '/'.$name if $name ne '/';
Branch: 1 branch
BranchTrueFalseTotal
if $name ne "/" 0 0 0
96  
97 0 $self->type . '://' . $perm . $loc;
98 }
99  
100 2 1;
« Box/Manager.pm ↑ Summary Box/Maildir.pm »