| 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
| |||||||||||||||||||||||||||||
| 32 | 48 | ▶ | undef $arg->{label} if defined $arg->{label} and not length $arg->{label}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $arg->{"label"} and not length $arg->{"label"}
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"}
| |||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 48 | for (qw(sends receives)) { | |||||||||||||||||||||||||||
| 35 | 96 | ▶ | $arg->{$_} = 1 unless exists $arg->{$_}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||