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   3503 use strict;
  5         11  
  5         162  
2 5     5   27 use warnings;
  5         9  
  5         215  
3             package App::Addex::AddressBook;
4             # ABSTRACT: the address book that addex will consult
5             $App::Addex::AddressBook::VERSION = '0.026';
6 5     5   2808 use App::Addex::Entry;
  5         18  
  5         164  
7              
8 5     5   27 use Carp ();
  5         11  
  5         606  
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 15 my ($class, $arg) = @_;
25 6 50       36 Carp::croak "no addex argument provided" unless $arg->{addex};
26 6         65 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 653 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.026
70              
71             =head1 METHODS
72              
73             =head2 new
74              
75             my $addr_book = App::Addex::AddressBook->new(\%arg);
76              
77             This method returns a new AddressBook. Its implementation details are left up
78             to the subclasses, but it must accept a hashref as its first argument.
79              
80             Valid arguments are:
81              
82             addex - required; the App::Addex object using this address book
83              
84             =head2 addex
85              
86             my $addex = $addr_book->addex;
87              
88             This returns the App::Addex object with which the address book is associated.
89              
90             =head2 entries
91              
92             my @entries = $addex->entries;
93              
94             This method returns the entries in the address book as L<App::Addex::Entry>
95             objects. Its behavior in scalar context is not yet defined.
96              
97             This method should be implemented by a address-book-implementation-specific
98             subclass.
99              
100             =head1 AUTHOR
101              
102             Ricardo SIGNES <rjbs@cpan.org>
103              
104             =head1 COPYRIGHT AND LICENSE
105              
106             This software is copyright (c) 2006 by Ricardo SIGNES.
107              
108             This is free software; you can redistribute it and/or modify it under
109             the same terms as the Perl 5 programming language system itself.
110              
111             =cut