File Coverage

blib/lib/WWW/Google/Contacts/ContactList.pm
Criterion Covered Total %
statement 9 12 75.0
branch n/a
condition n/a
subroutine 3 5 60.0
pod 0 2 0.0
total 12 19 63.1


line stmt bran cond sub pod time code
1             package WWW::Google::Contacts::ContactList;
2             {
3             $WWW::Google::Contacts::ContactList::VERSION = '0.39';
4             }
5              
6 17     17   106 use Moose;
  17         45  
  17         150  
7 17     17   120886 use WWW::Google::Contacts::Contact;
  17         48  
  17         1776  
8              
9             extends 'WWW::Google::Contacts::Base';
10              
11             with 'WWW::Google::Contacts::Roles::List';
12              
13             sub baseurl {
14 0     0 0   my $self = shift;
15 0           return sprintf( "%s://www.google.com/m8/feeds/contacts/default",
16             $self->server->protocol );
17             }
18 0     0 0   sub element_class { 'WWW::Google::Contacts::Contact' }
19              
20 17     17   101 no Moose;
  17         39  
  17         103  
21             __PACKAGE__->meta->make_immutable;
22             1;
23             __END__
24              
25             =head1 SYNOPSIS
26              
27             use WWW::Google::Contacts;
28              
29             my $google = WWW::Google::Contacts->new( username => "your.username", password => "your.password" );
30              
31             my $contacts = $google->contacts;
32              
33             while ( my $cont = $contacts->next ) {
34             print "You got a friend called " . $cont->full_name . "\n";
35              
36             if ( $cont->photo->exists ) {
37             print "And you got a photo of this friend\n";
38             $contact->photo->to_file( "/tmp/photo.jpg" );
39             }
40             }
41              
42             =head1 METHODS
43              
44             =head2 $contacts->next
45              
46             Returns the next L<WWW::Google::Contacts::Contact> object
47              
48             =head2 $contacts->search( $args )
49              
50             B<WARNING> This is quite slow at the moment, at least if you've got a lot of contacts.
51              
52             Given search criteria, will return all your contacts that matches critera.
53              
54             my @heroes = $contacts->search({
55             given_name => "Rutger",
56             family_name => "Hauer",
57             });
58              
59             B<TODO>: Speed up. Make search arguments more flexible ( AND / OR / Regex / ... ). Also, doubt that search on random things like IM addresses work right now..
60              
61             =head1 AUTHOR
62              
63             Magnus Erixzon <magnus@erixzon.com>
64              
65             =head1 COPYRIGHT AND LICENSE
66              
67             This software is copyright (c) 2010 by Magnus Erixzon / Fayland Lam.
68              
69             This is free software; you can redistribute it and/or modify it under
70             the same terms as perl itself.
71              
72             =cut
73