Addex/Entry/EmailAddress.pm

filter: Statementstmt 100% 20 / 20 Branchbran 83.3% 5 / 6 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 8 / 8 Podpod 100% 5 / 5 totaltotal 97.7% 43 / 44 CC 6 SCAR 12.0
CC
6
Cov
97%
new
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.3
« Addex.pm ↑ Summary Addex/Output/Procmail.pm »
1 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 package App::Addex::Entry::EmailAddress 0.027;
4 # ABSTRACT: an address book entry's email address
5  
6 #pod =head1 SYNOPSIS
7 #pod
8 #pod An App::Addex::Entry::EmailAddress object represents, well, an addess for an
9 #pod entry.
10 #pod
11 #pod =method new
12 #pod
13 #pod my $address = App::Addex::Entry::EmailAddress->new("dude@example.aero");
14 #pod
15 #pod my $address = App::Addex::Entry::EmailAddress->new(\%arg);
16 #pod
17 #pod Valid arguments are:
18 #pod
19 #pod address - the contact's email address
20 #pod label - the label for this contact (home, work, etc)
21 #pod there is no guarantee that labels are defined or unique
22 #pod
23 #pod sends - if true, this address may send mail; default: true
24 #pod receives - if true, this address may receive mail; default: true
25 #pod
26 #pod =cut
27  
28 48 ▶sub new {
Subroutine new: called CC=6 SCAR=17.9
Pod documented
29 48 my ($class, $arg) = @_;
30  
31 48 ▶ $arg = { address => $arg } if not ref $arg;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $arg 12 36 48
32 48 ▶ undef $arg->{label} if defined $arg->{label} and not length $arg->{label};
Branch: 1 branch
BranchTrueFalseTotal
if defined $arg->{"label"} and not length $arg->{"label"} 4 44 48
Condition100%3/3
defined $arg->{"label"} and not length $arg->{"label"}
!ll&&!rl&&r
20244
MC/DC100%2/2
defined $arg->{"label"} and not length $arg->{"label"}
defined $arg->{"label"} not length $arg->{"label"}
Truth table100%3/3
A and not(B)
A= defined $arg->{"label"}B= not length $arg->{"label"}
ABresult
0X0
100
111
33  
34 48 for (qw(sends receives)) {
35 96 ▶ $arg->{$_} = 1 unless exists $arg->{$_};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $arg->{$_} 96 0 96
36 }
37  
38 48 bless $arg => $class;
39 }
40  
41 #pod =method address
42 #pod
43 #pod This method returns the email address as a string.
44 #pod
45 #pod =cut
46  
47 4 ▶use overload '""' => 'address';
Subroutine BEGIN: called CC=1 SCAR=0.0
48  
49 65 ▶sub address {
Subroutine address: called CC=1 SCAR=0.0
Pod documented
50 $_[0]->{address}
51 65 }
52  
53 #pod =method label
54 #pod
55 #pod This method returns the address label, if any.
56 #pod
57 #pod =cut
58  
59 8 ▶sub label {
Subroutine label: called CC=1 SCAR=0.0
Pod documented
60 $_[0]->{label}
61 8 }
62  
63 #pod =method sends
64 #pod
65 #pod =method receives
66 #pod
67 #pod =cut
68  
69 18 ▶sub sends { $_[0]->{sends} }
Subroutine sends: called CC=1 SCAR=0.0
Pod documented
70 21 ▶sub receives { $_[0]->{receives} }
Subroutine receives: called CC=1 SCAR=0.0
Pod documented
71  
72 4 1;
73  
74 __END__
« Addex.pm ↑ Summary Addex/Output/Procmail.pm »