PicasaWeb/Feed.pm untested

filter: Statementstmt 0.0% 0 / 39 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 2 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 61 CC 8 SCAR 41.6
CC
8
Cov
0%
from_feed
72.0
BEGIN
2.0
CRAP 64.2
1 package Net::Google::PicasaWeb::Feed;
2 {
3 $Net::Google::PicasaWeb::Feed::VERSION = '0.12';
4 }
5 use Moose;
6  
7 # ABSTRACT: base class for feed entries
8  
9 extends 'Net::Google::PicasaWeb::Base';
10  
11  
12 has url => (
13 is => 'rw',
14 isa => 'Str',
15 );
16  
17  
18 has title => (
19 is => 'rw',
20 isa => 'Str',
21 );
22  
23  
24 has summary => (
25 is => 'rw',
26 isa => 'Str',
27 );
28  
29  
30 has author_name => (
31 is => 'rw',
32 isa => 'Str',
33 );
34  
35  
36 has author_uri => (
37 is => 'rw',
38 isa => 'Str',
39 );
40  
41  
42 has entry_id => (
43 is => 'rw',
44 isa => 'Str',
45 );
46  
47  
48 has user_id => (
49 is => 'rw',
50 isa => 'Str',
51 );
52  
53  
54 has latitude => (
55 is => 'rw',
56 isa => 'Num',
57 );
58  
59  
60 has longitude => (
61 is => 'rw',
62 isa => 'Num',
63 );
64  
65  
66 sub from_feed {
67 my ($class, $service, $entry) = @_;
68  
69 my $url = $entry->field('id');
70 $url =~ s/^\s+//; $url =~ s/\s+$//;
71 $url =~ s{/data/entry/}{/data/feed/};
72  
73 my %params = (
74 service => $service,
75 twig => $entry,
76 url => $url,
77 title => $entry->field('title'),
78 summary => $entry->field('summary'),
79 entry_id => $entry->field('gphoto:id'),
80 user_id => $entry->field('gphoto:user'),
81 );
82  
83 if (my $author = $entry->first_child('author')) {
84 $params{author_name} = $author->field('name')
85 if $author->has_child('name');
86 $params{author_uri} = $author->field('uri')
87 if $author->has_child('uri');
88 $params{user_id} ||= $author->field('gphoto:user')
89 if $author->has_child('gphoto:user');
90 }
91  
92 if (my $georss = $entry->first_child('georss:where')) {
93 if (my $point = $georss->first_child('gml:Point')) {
94 if (my $pos = $point->field('gml:pos') ) {
95
96 $pos =~ s/^\s+//;
97 my ($lat, $lon) = split /\s+/, $pos, 2;
98  
99 $params{latitude} = $lat;
100 $params{longitude} = $lon;
101 }
102 }
103 }
104  
105 return $class->new(\%params);
106 }
107  
108 __PACKAGE__->meta->make_immutable;
109  
110 1;
111  
112 __END__