Calendar/Comments.pm

filter: Statementstmt 33.3% 12 / 36 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 42.8% 3 / 7 Podpod 100% 4 / 4 totaltotal 34.5% 19 / 55 CC 5 SCAR 22.0
CC
5
Cov
27%
rel
20.0
feed_link
6.0
new
2.0
CRAP 9.0
« Calendar/Base.pm ↑ Summary
1 package Net::Google::Calendar::Comments;
2 {
3 6 $Net::Google::Calendar::Comments::VERSION = '1.05';
4 }
5  
6 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 6 ▶use Net::Google::Calendar::FeedLink;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 6 ▶use base qw(Net::Google::Calendar::Base XML::Atom::Link);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 =head1 NAME
11  
12 Net::Google::Calendar::Comments - represent comments
13  
14 =head1 SYNOPSIS
15  
16 my ($event) = $cal->get_events;
17 my $comments = $event->comments;
18
19 if (!defined $comments) {
20 die "No comments!\n";
21 }
22  
23 print "Comments are of type: ".$comments->rel."\n";
24 my $feed = $comments->feed_link;
25  
26 print "There are ".$feed->count_hint." comments in this feed\n";
27 print "Is this feed read only? ".$feed->read_only."\n";
28 print "This feed ".(($feed->href)? "is" : "isn't" )." remote\n";
29 print "This feed is of type ".$feed->rel."\n";
30 foreach my $comment ($cal->get_feed($feed->feed)->entries) {
31 print "\t".$comment->title."\n";
32 }
33  
34 =head1 METHODS
35  
36 =cut
37  
38 =head2 new
39  
40 =cut
41  
42 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
43 0 my $class = shift;
44 0 my %opts = @_;
45 0 my $self = $class->SUPER::new(Version => "1.0", %opts);
46 0 return $self;
47 }
48  
49 =head2 rel [rel]
50  
51 Type of comments contained within. Currently, there's a
52 distinction between regular comments and reviews.
53  
54 Returns either C<regular> (or C<undef> which means the same) or C<reviews>.
55  
56 =cut
57  
58 0 ▶sub rel {
Subroutine rel: not called CC=4 SCAR=30.0
Pod documented
59 0 my $self = shift;
60 0 my $pre = "http://schemas.google.com/g/2005#";
61 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
62 0 my $new = shift;
63 0 my @vals = qw(regular reviews);
64 die "$new is not one of the allowed values for rel (".join(",", @vals).")"
65 0 ▶ unless grep { $new eq $_ } @vals;
Branch: 1 branch
BranchTrueFalseTotal
unless grep {$new eq $_;} @vals 0 0 0
66 0 $self->set_attr('rel', "${pre}${new}");
67 }
68 0 my $rel = $self->get_attr('rel');
69 0 ▶ $rel =~ s!^$pre!! if defined $rel;
Branch: 1 branch
BranchTrueFalseTotal
if defined $rel 0 0 0
70 0 return $rel;
71 }
72  
73 =head2 element_name
74  
75 Our element name
76  
77 =cut
78  
79 0 ▶sub element_name {
Subroutine element_name: not called CC=1 SCAR=6.9
Pod documented
80 0 return 'gd:comments';
81 }
82  
83 =head2 feed_link [feed_link]
84  
85 Get or set the feed link objects.
86  
87 =cut
88  
89 0 ▶sub feed_link {
Subroutine feed_link: not called CC=2 SCAR=17.9
Pod documented
90 0 my $self = shift;
91 0 my $name = 'gd:feedLink';
92 0 my $ns = '';
93 #my $ns = "http://schemas.google.com/g/2005";
94 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
95 0 my $feed = shift;
96 0 XML::Atom::Base::set($self, $ns, $name, $feed, {});
97 #$self->set($ns, $name, $feed, {});
98  
99 }
100 0 my $tmp = $self->_my_get($ns, $name);
101 0 return Net::Google::Calendar::FeedLink->new(Elem => $tmp);
102 }
103  
104 6 1;
« Calendar/Base.pm ↑ Summary