File Coverage

blib/lib/App/Addex/AddressBook.pm
Criterion Covered Total %
statement 16 17 94.1
branch 1 2 50.0
condition n/a
subroutine 6 7 85.7
pod 3 3 100.0
total 26 29 89.6


line stmt bran cond sub pod time code
1 5     5   3153 use strict;
  5         11  
  5         148  
2 5     5   26 use warnings;
  5         10  
  5         186  
3             package App::Addex::AddressBook 0.027;
4             # ABSTRACT: the address book that addex will consult
5              
6 5     5   2188 use App::Addex::Entry;
  5         18  
  5         150  
7              
8 5     5   31 use Carp ();
  5         10  
  5         567  
9              
10             #pod =method new
11             #pod
12             #pod my $addr_book = App::Addex::AddressBook->new(\%arg);
13             #pod
14             #pod This method returns a new AddressBook. Its implementation details are left up
15             #pod to the subclasses, but it must accept a hashref as its first argument.
16             #pod
17             #pod Valid arguments are:
18             #pod
19             #pod addex - required; the App::Addex object using this address book
20             #pod
21             #pod =cut
22              
23             sub new {
24 6     6 1 19 my ($class, $arg) = @_;
25 6 50       32 Carp::croak "no addex argument provided" unless $arg->{addex};
26 6         83 bless { addex => $arg->{addex} } => $class;
27             }
28              
29             #pod =method addex
30             #pod
31             #pod my $addex = $addr_book->addex;
32             #pod
33             #pod This returns the App::Addex object with which the address book is associated.
34             #pod
35             #pod =cut
36              
37 0     0 1 0 sub addex { $_[0]->{addex} }
38              
39             #pod =method entries
40             #pod
41             #pod my @entries = $addex->entries;
42             #pod
43             #pod This method returns the entries in the address book as L<App::Addex::Entry>
44             #pod objects. Its behavior in scalar context is not yet defined.
45             #pod
46             #pod This method should be implemented by a address-book-implementation-specific
47             #pod subclass.
48             #pod
49             #pod =cut
50              
51             sub entries {
52 1     1 1 694 Carp::confess "no behavior defined for virtual method entries";
53             }
54              
55             1;
56              
57             __END__
58              
59             =pod
60              
61             =encoding UTF-8
62              
63             =head1 NAME
64              
65             App::Addex::AddressBook - the address book that addex will consult
66              
67             =head1 VERSION
68              
69             version 0.027
70              
71             =head1 PERL VERSION SUPPORT
72              
73             This module has the same support period as perl itself: it supports the two
74             most recent versions of perl. (That is, if the most recently released version
75             is v5.40, then this module should work on both v5.40 and v5.38.)
76              
77             Although it may work on older versions of perl, no guarantee is made that the
78             minimum required version will not be increased. The version may be increased
79             for any reason, and there is no promise that patches will be accepted to lower
80             the minimum required perl.
81              
82             =head1 METHODS
83              
84             =head2 new
85              
86             my $addr_book = App::Addex::AddressBook->new(\%arg);
87              
88             This method returns a new AddressBook. Its implementation details are left up
89             to the subclasses, but it must accept a hashref as its first argument.
90              
91             Valid arguments are:
92              
93             addex - required; the App::Addex object using this address book
94              
95             =head2 addex
96              
97             my $addex = $addr_book->addex;
98              
99             This returns the App::Addex object with which the address book is associated.
100              
101             =head2 entries
102              
103             my @entries = $addex->entries;
104              
105             This method returns the entries in the address book as L<App::Addex::Entry>
106             objects. Its behavior in scalar context is not yet defined.
107              
108             This method should be implemented by a address-book-implementation-specific
109             subclass.
110              
111             =head1 AUTHOR
112              
113             Ricardo SIGNES <rjbs@semiotic.systems>
114              
115             =head1 COPYRIGHT AND LICENSE
116              
117             This software is copyright (c) 2006 by Ricardo SIGNES.
118              
119             This is free software; you can redistribute it and/or modify it under
120             the same terms as the Perl 5 programming language system itself.
121              
122             =cut