POP3.pm

filter: Statementstmt 76.6% 36 / 47 Branchbran 7.1% 1 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 84.6% 11 / 13 Podpod 100% 3 / 3 totaltotal 66.2% 51 / 77 CC 8 SCAR 26.3
CC
8
Cov
61%
make_sane
42.0
from_file
6.0
read_config
2.0
CRAP 13.9
« POP3/Security/Connection.pm ↑ Summary POP3/Server.pm »
1 package Mail::POP3;
2  
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use IO::Socket;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use IO::File;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use POSIX;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 4 ▶use Mail::POP3::Daemon; # needs to handle signals!
Subroutine BEGIN: called CC=1 SCAR=0.0
9 4 ▶use Mail::POP3::Server;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 4 ▶use Mail::POP3::Folder::maildir;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 ▶use Mail::POP3::Folder::mbox;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 4 ▶use Mail::POP3::Folder::mbox::parse_to_disk;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 4 ▶use Mail::POP3::Security::Connection;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 # use Mail::POP3::Security::User;
15 # use Mail::POP3::Security::User::system;
16 # use Mail::POP3::Security::User::vdomain;
17  
18 # UIDL is the Message-ID
19  
20 4 our $VERSION = "3.11";
21  
22 2 ▶sub read_config {
Subroutine read_config: called CC=2 SCAR=7.0
Pod documented
23 2 my ($class, $config_text) = @_;
24 2 my $config = eval $config_text;
25 # mpopd config files have a version number of their own which must
26 # be the same as the Mail::POP3 version. As mpopd develops, new features
27 # may require new config items or syntax so the version number of
28 # the config file must be checked first.
29 2 ▶ die <<EOF if $config->{mpopd_conf_version} ne $VERSION;
Branch: 1 branch
BranchTrueFalseTotal
if $config->{"mpopd_conf_version"} ne $Mail::POP3::VERSION 0 2 2
30 Sorry, Mail::POP3 v$VERSION requires an mpopd config file conforming
31 to config version '$VERSION'.
32 Your config file is version '$config->{mpopd_conf_version}'
33 EOF
34 2 $config;
35 }
36  
37 0 ▶sub make_sane {
Subroutine make_sane: not called CC=6 SCAR=37.4
Pod documented
38 0 my ($class, $config_hash) = @_;
39 # Create a sane environment if not configured in mpop.conf
40 0 ▶ $config_hash->{port} = 110 if $config_hash->{port} !~ /^\d+$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $config_hash->{"port"} =~ /^\d+$/ 0 0 0
41 $config_hash->{message_start} = "^From "
42 0 ▶ if $config_hash->{message_start} !~ /^\S+$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $config_hash->{"message_start"} =~ /^\S+$/ 0 0 0
43 $config_hash->{message_end} = "^\\s*\$"
44 0 ▶ if $config_hash->{message_end} !~ /^\S+$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $config_hash->{"message_end"} =~ /^\S+$/ 0 0 0
45 $config_hash->{timeout} = 10
46 0 ▶ if $config_hash->{timeout} !~ /^\d+$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $config_hash->{"timeout"} =~ /^\d+$/ 0 0 0
47 # Make disk-based parsing the default
48 $config_hash->{parse_to_disk} = 1
49 0 ▶ unless defined $config_hash->{parse_to_disk};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $config_hash->{"parse_to_disk"} 0 0 0
50 0 $config_hash->{greeting} =~ s/([\w\.-_:\)\(]{50}).*/$1/;
51 }
52  
53 0 ▶sub from_file {
Subroutine from_file: not called CC=2 SCAR=17.9
Pod documented
54 0 my ($class, $file) = @_;
55 0 local (*FH, $/);
56 0 ▶ open FH, $file or die "$file: $!\n";
Branch: 1 branch
BranchTrueFalseTotal
open FH, $file or die "${file}: $!\n" 0 0 0
57 0 <FH>;
58 }
59  
60 4 1;
61  
62 __END__
« POP3/Security/Connection.pm ↑ Summary POP3/Server.pm »