Box/POP3/Test.pm

filter: Statementstmt 57.1% 24 / 42 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 70.0% 7 / 10 Podpod 0.0% 0 / 2 totaltotal 49.2% 31 / 63 SCAR 21.4
CC
5
Cov
48%
start_pop3_server
30.0
__ANON__
2.0
start_pop3_client
2.0
CRAP 8.5
« Box/POP3/Message.pm ↑ Summary Box/POP3s.pm »
1 # Copyrights 2001-2019 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-POP3. 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::POP3::Test;
10 4 ▶use vars '$VERSION';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 $VERSION = '3.005';
12  
13 4 ▶use base 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 4 ▶use Mail::Transport::POP3;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 4 ▶use List::Util 'first';
Subroutine BEGIN: called CC=1 SCAR=0.0
21 4 ▶use File::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 4 our @EXPORT = qw/start_pop3_server start_pop3_client/;
24  
25 #
26 # Start POP3 server for tests
27 #
28  
29 sub start_pop3_server($;$)
30 0 ▶{ my $popbox = shift;
Subroutine start_pop3_server: not called CC=5 SCAR=34.0
Pod undocumented
31 0 ▶ my $setting = shift || '';
Condition0%0/2
shift() || ''
l!l
00
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
32  
33 0 my $serverscript = File::Spec->catfile('t', 'server');
34  
35 # Some complications to find-out $perl, which must be absolute and
36 # untainted for perl5.6.1, but not for the other Perl's.
37 0 my $perl = $^X;
38 0 ▶ unless(File::Spec->file_name_is_absolute($perl))
Branch: 1 branch
BranchTrueFalseTotal
unless ("File::Spec"->file_name_is_absolute($perl)) 0 0 0
39 0 { my @path = split /\:|\;/, $ENV{PATH};
40 0 ▶ $perl = first { -x $_ }
Subroutine __ANON__: not called CC=1 SCAR=6.9
41 0 map { File::Spec->catfile($_, $^X) }
42 @path;
43 }
44  
45 0 $perl =~ m/(.*)/;
46 0 $perl = $1;
47  
48 0 %ENV = ();
49  
50 0 ▶ open(my $server, "$perl $serverscript $popbox $setting|")
Branch: 1 branch
BranchTrueFalseTotal
open my $server, "$perl $serverscript $popbox $setting|" or die "Could not start POP3 server\n" 0 0 0
51 or die "Could not start POP3 server\n";
52  
53 0 my $line = <$server>;
54 0 ▶ my $port = $line =~ m/(\d+)/ ? $1
Branch: 1 branch
BranchTrueFalseTotal
$line =~ /(\d+)/ ? : 0 0 0
55 : die "Did not get port specification, but '$line'";
56  
57 0 ($server, $port);
58 }
59  
60 #
61 # START_POP3_CLIENT PORT, OPTIONS
62 #
63  
64 sub start_pop3_client($@)
65 0 ▶{ my ($port, @options) = @_;
Subroutine start_pop3_client: not called CC=1 SCAR=6.9
Pod undocumented
66
67 0 Mail::Transport::POP3->new
68 ( hostname => '127.0.0.1'
69 , port => $port
70 , username => 'user'
71 , password => 'password'
72 , @options
73 );
74 }
75  
76 4 1;
« Box/POP3/Message.pm ↑ Summary Box/POP3s.pm »