Addex/Entry.pm

filter: Statementstmt 100% 23 / 23 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 100% 4 / 4 totaltotal 100% 37 / 37 CC 2 SCAR 2.0
CC
2
Cov
100%
new
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« Addex/AddressBook.pm ↑ Summary Addex/Output.pm »
1 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 package App::Addex::Entry 0.027;
4 # ABSTRACT: an entry in your address book
5  
6 5 ▶use Mixin::ExtraFields::Param -fields => {
Subroutine BEGIN: called CC=1 SCAR=0.0
7 driver => 'HashGuts',
8 moniker => 'field',
9 id => undef,
10 5 };
11  
12 5 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 #pod =method new
15 #pod
16 #pod my $entry = App::Addex::Entry->new(\%arg);
17 #pod
18 #pod This method returns an Addex Entry object.
19 #pod
20 #pod Valid parameters (sure to change) are:
21 #pod
22 #pod name - a full name (required)
23 #pod nick - a nickname (optional)
24 #pod emails - an arrayref of email addresses (required)
25 #pod
26 #pod =cut
27  
28 24 ▶sub new {
Subroutine new: called CC=2 SCAR=6.9
Pod documented
29 24 my ($class, $arg) = @_;
30  
31 # XXX: do some validation -- rjbs, 2007-04-06
32 my $self = {
33 name => $arg->{name},
34 nick => $arg->{nick},
35 emails => $arg->{emails},
36 24 };
37  
38 24 bless $self => $class;
39  
40 24 ▶ $self->field(%{ $arg->{fields} }) if $arg->{fields};
Branch: 1 branch
BranchTrueFalseTotal
if $arg->{"fields"} 16 8 24
41  
42 24 return $self;
43 }
44  
45 #pod =method name
46 #pod
47 #pod =method nick
48 #pod
49 #pod These methods return the value of the property they name.
50 #pod
51 #pod =cut
52  
53 86 ▶sub name { $_[0]->{name} }
Subroutine name: called CC=1 SCAR=0.0
Pod documented
54 6 ▶sub nick { $_[0]->{nick} }
Subroutine nick: called CC=1 SCAR=0.0
Pod documented
55  
56 #pod =method emails
57 #pod
58 #pod This method returns the entry's email addresses. In scalar context it returns
59 #pod the number of addresses.
60 #pod
61 #pod =cut
62  
63 21 ▶sub emails { @{ $_[0]->{emails} } }
Subroutine emails: called CC=1 SCAR=0.0
Pod documented
64  
65 #pod =method field
66 #pod
67 #pod my $value = $entry->field($name);
68 #pod
69 #pod $entry->field($name => $value);
70 #pod
71 #pod This method is generated by L<Mixin::ExtraFields::Param|Mixin::ExtraFields::Param>.
72 #pod
73 #pod =cut
74  
75 5 1;
76  
77 __END__
« Addex/AddressBook.pm ↑ Summary Addex/Output.pm »