| 1 | package Net::Google::Calendar::Entry; | ||||||||||||||||||||||||||||
| 2 | { | ||||||||||||||||||||||||||||
| 3 | 6 | $Net::Google::Calendar::Entry::VERSION = '1.05'; | |||||||||||||||||||||||||||
| 4 | } | ||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 6 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 6 | ▶ | use DateTime; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 6 | ▶ | use XML::Atom; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 6 | ▶ | use XML::Atom::Entry; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 6 | ▶ | use XML::Atom::Util qw( set_ns first nodelist childlist iso2dt create_element); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 6 | ▶ | use base qw(XML::Atom::Entry Net::Google::Calendar::Base); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 6 | ▶ | use Net::Google::Calendar::Person; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 6 | ▶ | use Net::Google::Calendar::Comments; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | =head1 NAME | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | Net::Google::Calendar::Entry - entry class for Net::Google::Calendar | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | my $event = Net::Google::Calendar::Entry->new(); | ||||||||||||||||||||||||||||
| 24 | $event->title('Party!'); | ||||||||||||||||||||||||||||
| 25 | $event->content('P-A-R-T-Why? Because we GOTTA!'); | ||||||||||||||||||||||||||||
| 26 | $event->location("My Flat, London, England"); | ||||||||||||||||||||||||||||
| 27 | $event->status('confirmed'); | ||||||||||||||||||||||||||||
| 28 | $event->transparency('opaque'); | ||||||||||||||||||||||||||||
| 29 | $event->visibility('private'); | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | my $author = Net::Google::Calendar::Person->new; | ||||||||||||||||||||||||||||
| 32 | $author->name('Foo Bar'); | ||||||||||||||||||||||||||||
| 33 | $author->email('foo@bar.com'); | ||||||||||||||||||||||||||||
| 34 | $entry->author($author); | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | =head1 METHODS | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | =head2 new | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | Create a new Event object | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | =cut | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 49 | 0 | my ($class, %opts) = @_; | |||||||||||||||||||||||||||
| 50 | 0 | my $self = $class->SUPER::new( Version => '1.0', %opts ); | |||||||||||||||||||||||||||
| 51 | 0 | $self->_initialize(); | |||||||||||||||||||||||||||
| 52 | 0 | return $self; | |||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 0 | ▶ | sub _initialize { | ||||||||||||||||||||||||||
|
Subroutine
_initialize: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 56 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 57 | 0 | $self->SUPER::_initialize(); | |||||||||||||||||||||||||||
| 58 | 0 | $self->category({ scheme => 'http://schemas.google.com/g/2005#kind', term => 'http://schemas.google.com/g/2005#event' } ); | |||||||||||||||||||||||||||
| 59 | 0 | $self->set_attr('xmlns:gd', 'http://schemas.google.com/g/2005'); | |||||||||||||||||||||||||||
| 60 | 0 | $self->set_attr('xmlns:gCal', 'http://schemas.google.com/gCal/2005'); | |||||||||||||||||||||||||||
| 61 | 0 | ▶ | unless ( $self->{_gd_ns} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 62 | 0 | $self->{_gd_ns} = XML::Atom::Namespace->new(gd => 'http://schemas.google.com/g/2005'); | |||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||
| 64 | 0 | ▶ | unless ( $self->{_gcal_ns} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 65 | 0 | $self->{_gcal_ns} = XML::Atom::Namespace->new(gCal => 'http://schemas.google.com/gCal/2005'); | |||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | =head2 id [id] | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | Get or set the id. | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | =cut | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | =head2 title [title] | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | Get or set the title. | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | =cut | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | =head2 content [content] | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | Get or set the content. | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | =cut | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 0 | ▶ | sub content { | ||||||||||||||||||||||||||
|
Subroutine
content: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 89 | 0 | my $self= shift; | |||||||||||||||||||||||||||
| 90 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 91 | 0 | $self->set($self->ns, 'content', shift); | |||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||
| 93 | 0 | return $self->SUPER::content; | |||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | =head2 author [author] | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | Get or set the author | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | =cut | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | =head2 transparency [transparency] | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | Get or set the transparency. Transparency should be one of | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | opaque | ||||||||||||||||||||||||||||
| 107 | transparent | ||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | =cut | ||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | 0 | ▶ | sub transparency { | ||||||||||||||||||||||||||
|
Subroutine
transparency: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 112 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 113 | 0 | return $self->_gd_element('transparency', @_); | |||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | =head2 visibility [visibility] | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | Get or set the visibility. Visibility should be one of | ||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | confidential | ||||||||||||||||||||||||||||
| 122 | default | ||||||||||||||||||||||||||||
| 123 | private | ||||||||||||||||||||||||||||
| 124 | public | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | =cut | ||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | 0 | ▶ | sub visibility { | ||||||||||||||||||||||||||
|
Subroutine
visibility: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 129 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 130 | 0 | return $self->_gd_element('visibility', @_); | |||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | =head2 status [status] | ||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | Get or set the status. Status should be one of | ||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | canceled | ||||||||||||||||||||||||||||
| 138 | confirmed | ||||||||||||||||||||||||||||
| 139 | tentative | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | =cut | ||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | 0 | ▶ | sub status { | ||||||||||||||||||||||||||
|
Subroutine
status: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 144 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 145 | 0 | return $self->_gd_element('eventStatus', @_); | |||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | =head2 is_allday | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | Get the allday flag. | ||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | Returns 1 of event is an All Day event, 0 if not, undef if it can't be | ||||||||||||||||||||||||||||
| 155 | determined. | ||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||
| 157 | =cut | ||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | 0 | ▶ | sub is_allday { | ||||||||||||||||||||||||||
|
Subroutine
is_allday: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||
| 160 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | 0 | my $start = $self->_attribute_get($self->{_gd_ns}, 'when', 'startTime'); | |||||||||||||||||||||||||||
| 163 | 0 | my $end = $self->_attribute_get($self->{_gd_ns}, 'when', 'endTime'); | |||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | 0 | my $startok = undef; | |||||||||||||||||||||||||||
| 166 | 0 | my $endok = undef; | |||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | 0 | ▶ | if ($start =~ /^[0-9]{4}-[0-1][0-9]-[0-3][0-9]$/) { $startok = 1; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 169 | 0 | ▶ | if ($end =~ /^[0-9]{4}-[0-1][0-9]-[0-3][0-9]$/) { $endok = 1; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | 0 | ▶ | if ($startok && $endok) { return 1; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$startok and $endok
MC/DC0%0/2
$startok and $endok
$startok
$endok
Truth table0%0/3
A and B
A= $startokB= $endok
| |||||||||||||||||||||||||||||
| 172 | 0 | ▶ | if (!$startok && !$endok) { return 0; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$startok or $endok
MC/DC0%0/2
$startok or $endok
$startok
$endok
Truth table0%0/3
A or B
A= $startokB= $endok
| |||||||||||||||||||||||||||||
| 173 | 0 | return undef; | |||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | =head2 extended_property [property] | ||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | Get or set an extended property | ||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||
| 181 | =cut | ||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | 0 | ▶ | sub extended_property { | ||||||||||||||||||||||||||
|
Subroutine
extended_property: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 184 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 185 | 0 | return $self->_multi_gd_element('extendedProperty', @_); | |||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | 0 | ▶ | sub _multi_gd_element { | ||||||||||||||||||||||||||
|
Subroutine
_multi_gd_element: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 189 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 190 | 0 | $self->_gd_elem_generic(1, @_); | |||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||
| 193 | 0 | ▶ | sub _gd_element{ | ||||||||||||||||||||||||||
|
Subroutine
_gd_element: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 194 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 195 | 0 | $self->_gd_elem_generic(0, @_); | |||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||
| 198 | 0 | ▶ | sub _gd_elem_generic{ | ||||||||||||||||||||||||||
|
Subroutine
_gd_elem_generic: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||
| 199 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 200 | 0 | my $multi = shift; | |||||||||||||||||||||||||||
| 201 | 0 | my $elem = shift; | |||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||
| 203 | 0 | ▶ | if ($elem eq "extendedProperty") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 204 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 205 | 0 | my $name = shift; | |||||||||||||||||||||||||||
| 206 | 0 | my $val = shift; | |||||||||||||||||||||||||||
| 207 | 0 | ▶ | my $op = $multi ? 'add' : 'set'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 208 | 0 | $self->$op($self->{_gd_ns}, "${elem}" => "", { name => $name, value => $val } ); | |||||||||||||||||||||||||||
| 209 | 0 | return $val; | |||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||
| 211 | 0 | my $ret = {}; | |||||||||||||||||||||||||||
| 212 | 0 | for my $item ($self->_my_getlist($self->{_gd_ns} ,$elem)) { | |||||||||||||||||||||||||||
| 213 | 0 | $ret->{$item->getAttribute('name')} = $item->getAttribute('value'); | |||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||
| 215 | 0 | return $ret; | |||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 219 | 0 | my $val = lc(shift); | |||||||||||||||||||||||||||
| 220 | 0 | ▶ | my $op = ($multi)? 'add' : 'set'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 221 | 0 | $self->$op($self->{_gd_ns}, "${elem}", '', { value => "http://schemas.google.com/g/2005#event.${val}" }); | |||||||||||||||||||||||||||
| 222 | 0 | return $val; | |||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||
| 224 | 0 | my $val = $self->_attribute_get($self->{_gd_ns}, $elem, 'value'); | |||||||||||||||||||||||||||
| 225 | 0 | $val =~ s!^http://schemas.google.com/g/2005#event\.!!; | |||||||||||||||||||||||||||
| 226 | 0 | return $val; | |||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||
| 229 | 0 | ▶ | sub _attribute_get { | ||||||||||||||||||||||||||
|
Subroutine
_attribute_get: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 230 | 0 | my ($self, $ns, $what, $key) = @_; | |||||||||||||||||||||||||||
| 231 | 0 | my $elem = $self->_my_get($self->{_gd_ns}, $what, $key); | |||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||
| 233 | 0 | ▶ | if (defined($elem) && $elem->hasAttribute($key)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $elem and $elem->hasAttribute($key)
MC/DC0%0/2
defined $elem and $elem->hasAttribute($key)
defined $elem
$elem->hasAttribute($key)
Truth table0%0/3
A and B
A= defined $elemB= $elem->hasAttribute($key)
| |||||||||||||||||||||||||||||
| 234 | 0 | return $elem->getAttribute($key); | |||||||||||||||||||||||||||
| 235 | } else { | ||||||||||||||||||||||||||||
| 236 | 0 | return $elem; | |||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||
| 240 | =head2 location [location] | ||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||
| 242 | Get or set the location | ||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | =cut | ||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||
| 246 | 0 | ▶ | sub location { | ||||||||||||||||||||||||||
|
Subroutine
location: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 247 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||
| 249 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 250 | 0 | my $val = shift; | |||||||||||||||||||||||||||
| 251 | 0 | $self->set($self->{_gd_ns}, 'where' => '', { valueString => $val}); | |||||||||||||||||||||||||||
| 252 | 0 | return $val; | |||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||
| 255 | 0 | return $self->_attribute_get($self->{_gd_ns}, 'where', 'valueString'); | |||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||
| 259 | =head2 quick_add [bool] | ||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||
| 261 | Get or set whether this is a a quick add entry or not. | ||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||
| 263 | =cut | ||||||||||||||||||||||||||||
| 264 | 0 | ▶ | sub quick_add { | ||||||||||||||||||||||||||
|
Subroutine
quick_add: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 265 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||
| 267 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 268 | 0 | ▶ | my $val = ($_[0])? 'true' : 'false'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 269 | 0 | $self->set( $self->{_gcal_ns}, quickadd => '', { value => $val } ); | |||||||||||||||||||||||||||
| 270 | 0 | return $_[0]; | |||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||
| 272 | 0 | my $val = $self->_attribute_get($self->{_gcal_ns}, 'quickadd', 'valueString'); | |||||||||||||||||||||||||||
| 273 | 0 | return ($val eq 'true'); | |||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||
| 278 | =head2 when [<start> <end> [allday]] | ||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | Get or set the start and end time as supplied as DateTime objects. | ||||||||||||||||||||||||||||
| 281 | End must be more than start. | ||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||
| 283 | You may optionally pass a paramter in designating if this is an all day event or not. | ||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||
| 285 | Returns two DateTime objects depicting the start and end and a flag noting whether it's an all day event. | ||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||
| 288 | =cut | ||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||
| 290 | 0 | ▶ | sub when { | ||||||||||||||||||||||||||
|
Subroutine
when: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||
| 291 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||
| 293 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 294 | 0 | my ($start, $end, $allday) = @_; | |||||||||||||||||||||||||||
| 295 | 0 | ▶ | $allday = 0 unless defined $allday; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 296 | 0 | ▶ | unless ($end>=$start) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 297 | 0 | $@ = "End is not less than start"; | |||||||||||||||||||||||||||
| 298 | 0 | return undef; | |||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||
| 300 | 0 | $start->set_time_zone('UTC'); | |||||||||||||||||||||||||||
| 301 | 0 | $end->set_time_zone('UTC'); | |||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||
| 303 | 0 | ▶ | my $format = $allday ? "%F" : "%FT%TZ"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||
| 305 | 0 | $self->set($self->{_gd_ns}, "when", '', { | |||||||||||||||||||||||||||
| 306 | startTime => $start->strftime($format), | ||||||||||||||||||||||||||||
| 307 | endTime => $end->strftime($format), | ||||||||||||||||||||||||||||
| 308 | }); | ||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||
| 310 | 0 | my $start = $self->_attribute_get($self->{_gd_ns}, 'when', 'startTime'); | |||||||||||||||||||||||||||
| 311 | 0 | my $end = $self->_attribute_get($self->{_gd_ns}, 'when', 'endTime'); | |||||||||||||||||||||||||||
| 312 | 0 | my @rets; | |||||||||||||||||||||||||||
| 313 | 0 | ▶ | if (defined $start) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 314 | 0 | push @rets, $start; | |||||||||||||||||||||||||||
| 315 | } else { | ||||||||||||||||||||||||||||
| 316 | 0 | return @rets; | |||||||||||||||||||||||||||
| 317 | #die "No start date ".$self->as_xml; | ||||||||||||||||||||||||||||
| 318 | } | ||||||||||||||||||||||||||||
| 319 | 0 | ▶ | if (defined $end) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 320 | 0 | push @rets, $end; | |||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||
| 322 | 0 | return (map { iso2dt($_) } @rets), $self->is_allday; | |||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||
| 326 | =head2 reminder <method> <type> <when> | ||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||
| 328 | Sets a reminder on this entry. | ||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||
| 330 | C<method> must be one of: | ||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||
| 332 | alert email sms | ||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||
| 334 | C<type> must be one of | ||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||
| 336 | days hours minutes absoluteTime | ||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||
| 338 | If the type is C<absoluteTime> then C<when> should be either a iso formatted date string or a DateTime object. | ||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||
| 340 | =cut | ||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||
| 342 | 0 | ▶ | sub reminder { | ||||||||||||||||||||||||||
|
Subroutine
reminder: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 343 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 344 | 0 | my ($method, $type, $time) = @_; | |||||||||||||||||||||||||||
| 345 | 0 | ▶ | return undef unless ($method =~ /alert|email|sms/); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 346 | 0 | ▶ | return undef unless ($type =~ /days|hours|minutes|absoluteTime/); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 347 | 0 | ▶ | $time = $time->strftime("%FT%TZ") if ref($time) && $time->isa('DateTime'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $time and $time->isa("DateTime")
MC/DC0%0/2
ref $time and $time->isa("DateTime")
ref $time
$time->isa("DateTime")
Truth table0%0/3
A and B
A= ref $timeB= $time->isa("DateTime")
| |||||||||||||||||||||||||||||
| 348 | 0 | for my $item ($self->_my_getlist($self->{_gd_ns} ,'when')) { | |||||||||||||||||||||||||||
| 349 | 0 | my $elem = create_element($self->{_gd_ns}, 'reminder'); | |||||||||||||||||||||||||||
| 350 | 0 | $elem->setAttribute('method', $method); | |||||||||||||||||||||||||||
| 351 | 0 | $elem->setAttribute($type, $time); | |||||||||||||||||||||||||||
| 352 | 0 | $item->appendChild($elem); | |||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||
| 354 | 0 | return 1; | |||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||
| 361 | =head2 who [Net::Google::Calendar::Person[s]] | ||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||
| 363 | Get or set the list of event invitees. | ||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||
| 365 | If no parameters are passed then it returns a list containing zero | ||||||||||||||||||||||||||||
| 366 | or more Net::Google::Calendar::Person objects. | ||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||
| 368 | If you pass in one or more Net::Google::Calendar::Person objects then | ||||||||||||||||||||||||||||
| 369 | they get set as the invitees. | ||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||
| 371 | =cut | ||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||
| 373 | # http://code.google.com/apis/gdata/elements.html#gdWho | ||||||||||||||||||||||||||||
| 374 | 0 | ▶ | sub who { | ||||||||||||||||||||||||||
|
Subroutine
who: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 375 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||
| 377 | 0 | my $ns_uri = ""; # $self->{_gd_ns}; | |||||||||||||||||||||||||||
| 378 | 0 | my $name = 'gd:who'; | |||||||||||||||||||||||||||
| 379 | 0 | foreach my $who (@_) { | |||||||||||||||||||||||||||
| 380 | 0 | $self->add($ns_uri,"${name}", $who, {}); | |||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||
| 382 | my @who = map { | ||||||||||||||||||||||||||||
| 383 | 0 | my $person = Net::Google::Calendar::Person->new(); | |||||||||||||||||||||||||||
| 384 | 0 | for my $attr ($_->attributes) { | |||||||||||||||||||||||||||
| 385 | 0 | my $name = $attr->nodeName; | |||||||||||||||||||||||||||
| 386 | 0 | ▶ | my $val = $attr->value || ""; | ||||||||||||||||||||||||||
|
Condition0%0/2
$attr->value || ''
MC/DC0%0/1
$attr->value || ''
$attr->value
Truth table0%0/2
A
A= $attr->value
| |||||||||||||||||||||||||||||
| 387 | #print "$name = $val\n"; | ||||||||||||||||||||||||||||
| 388 | 0 | eval { $person->_do('@'.$name, $val) }; | |||||||||||||||||||||||||||
| 389 | 0 | ▶ | next if $@; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 390 | } | ||||||||||||||||||||||||||||
| 391 | 0 | foreach my $child ($_->childNodes) { | |||||||||||||||||||||||||||
| 392 | 0 | my $name = $child->nodeName; | |||||||||||||||||||||||||||
| 393 | 0 | my $val = $child->getAttribute('value'); | |||||||||||||||||||||||||||
| 394 | #print "$name = $val\n"; | ||||||||||||||||||||||||||||
| 395 | 0 | $person->_do($name, $val); | |||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||
| 397 | #print $person->as_xml; | ||||||||||||||||||||||||||||
| 398 | #print "\n\n"; | ||||||||||||||||||||||||||||
| 399 | 0 | $person; | |||||||||||||||||||||||||||
| 400 | } $self->_my_getlist($ns_uri,$name); | ||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||
| 403 | =head2 comments [comment[s]] | ||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||
| 405 | Get or set Comments object. | ||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||
| 407 | =cut | ||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||
| 409 | 0 | ▶ | sub comments { | ||||||||||||||||||||||||||
|
Subroutine
comments: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 410 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||
| 412 | 0 | my $ns_uri = $self->{_gd_ns}; | |||||||||||||||||||||||||||
| 413 | 0 | my $name = 'gd:comments'; | |||||||||||||||||||||||||||
| 414 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 415 | 0 | $self->add($ns_uri,"${name}", shift, {}); | |||||||||||||||||||||||||||
| 416 | } | ||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||
| 418 | 0 | my $tmp = $self->_my_get($ns_uri, $name); | |||||||||||||||||||||||||||
| 419 | 0 | my $comment = Net::Google::Calendar::Comments->new(); | |||||||||||||||||||||||||||
| 420 | 0 | for my $attr ($tmp->attributes) { | |||||||||||||||||||||||||||
| 421 | 0 | my $name = $attr->nodeName; | |||||||||||||||||||||||||||
| 422 | 0 | ▶ | my $val = $attr->value || ""; | ||||||||||||||||||||||||||
|
Condition0%0/2
$attr->value || ''
MC/DC0%0/1
$attr->value || ''
$attr->value
Truth table0%0/2
A
A= $attr->value
| |||||||||||||||||||||||||||||
| 423 | 0 | eval { $comment->_do('@'.$name, $val) }; | |||||||||||||||||||||||||||
| 424 | 0 | ▶ | next if $@; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 425 | } | ||||||||||||||||||||||||||||
| 426 | 0 | my $feed = Net::Google::Calendar::FeedLink->new(Elem => $tmp->firstChild); | |||||||||||||||||||||||||||
| 427 | 0 | ▶ | $comment->feed_link($feed) if $feed; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 428 | 0 | return $comment; | |||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||
| 434 | =head2 edit_url | ||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||
| 436 | Return the edit url of this event. | ||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||
| 438 | =cut | ||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||
| 441 | 0 | ▶ | sub edit_url { | ||||||||||||||||||||||||||
|
Subroutine
edit_url: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 442 | 0 | return $_[0]->_generic_url('edit'); | |||||||||||||||||||||||||||
| 443 | } | ||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||
| 446 | =head2 self_url | ||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||
| 448 | Return the self url of this event. | ||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||
| 450 | =cut | ||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||
| 454 | 0 | ▶ | sub self_url { | ||||||||||||||||||||||||||
|
Subroutine
self_url: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 455 | 0 | return $_[0]->_generic_url('self'); | |||||||||||||||||||||||||||
| 456 | } | ||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||
| 459 | =head2 html_url | ||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||
| 461 | Return the 'alternate' browser-friendly url of this event. | ||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||
| 463 | =cut | ||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||
| 465 | 0 | ▶ | sub html_url { | ||||||||||||||||||||||||||
|
Subroutine
html_url: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 466 | 0 | return $_[0]->_generic_url('alternate'); | |||||||||||||||||||||||||||
| 467 | } | ||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||
| 471 | =head2 recurrence [ Data::ICal::Entry::Event ] | ||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||
| 473 | Get or set a recurrence for an entry - this is in the form of a Data::ICal::Entry::Event object. | ||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||
| 475 | Returns undef if there's no recurrence event | ||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||
| 477 | This will not work if C<Data::ICal> is not installed and will return undef. | ||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||
| 479 | For example ... | ||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||
| 481 | $event->title('Pay Day'); | ||||||||||||||||||||||||||||
| 482 | $event->start(DateTime->now); | ||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||
| 484 | my $recurrence = Data::ICal::Entry::Event->new(); | ||||||||||||||||||||||||||||
| 485 | |||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||
| 487 | my $last_day_of_the_month = DateTime::Event::Recurrence->monthly( days => -1 ); | ||||||||||||||||||||||||||||
| 488 | $recurrence->add_properties( | ||||||||||||||||||||||||||||
| 489 | dtstart => DateTime::Format::ICal->format_datetime(DateTime->now), | ||||||||||||||||||||||||||||
| 490 | rrule => DateTime::Format::ICal->format_recurrence($last_day_of_the_month), | ||||||||||||||||||||||||||||
| 491 | ); | ||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||
| 493 | $entry->recurrence($recurrence); | ||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||
| 495 | To get the recurrence back: | ||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||
| 497 | print $entry->recurrence->as_string; | ||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||
| 499 | See | ||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||
| 501 | http://code.google.com/apis/gdata/common-elements.html#gdRecurrence | ||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||
| 503 | For more details | ||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||
| 505 | =cut | ||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||
| 507 | 0 | ▶ | sub recurrence { | ||||||||||||||||||||||||||
|
Subroutine
recurrence: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 508 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||
| 510 | # we need Data::ICal for this but we don't wnat to require it | ||||||||||||||||||||||||||||
| 511 | 0 | eval { | |||||||||||||||||||||||||||
| 512 | 0 | require Data::ICal; | |||||||||||||||||||||||||||
| 513 | 0 | Data::ICal->import; | |||||||||||||||||||||||||||
| 514 | 0 | require Data::ICal::Entry::Event; | |||||||||||||||||||||||||||
| 515 | 0 | Data::ICal::Entry::Event->import; | |||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||
| 517 | }; | ||||||||||||||||||||||||||||
| 518 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 519 | 0 | $@ = "Couldn't load Data::ICal or Data::ICal::Entry::Event: $@"; | |||||||||||||||||||||||||||
| 520 | 0 | return; | |||||||||||||||||||||||||||
| 521 | } | ||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||
| 523 | # this is all one massive hack. | ||||||||||||||||||||||||||||
| 524 | # I hate myself for writing this. | ||||||||||||||||||||||||||||
| 525 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 526 | 0 | my $event = shift; | |||||||||||||||||||||||||||
| 527 | # pesky Google Calendar needs you to remove the BEGIN:VEVENT END:VEVENT. TSSSK | ||||||||||||||||||||||||||||
| 528 | 0 | my $recur = $event->as_string; | |||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||
| 530 | 0 | $recur =~ s!(^BEGIN:VEVENT\n|END:VEVENT\n$)!!sg; | |||||||||||||||||||||||||||
| 531 | 0 | $self->set($self->{_gd_ns}, 'recurrence', $recur); | |||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||
| 533 | 0 | return $event; | |||||||||||||||||||||||||||
| 534 | } | ||||||||||||||||||||||||||||
| 535 | 0 | my $string = $self->get($self->{_gd_ns}, 'recurrence'); | |||||||||||||||||||||||||||
| 536 | 0 | ▶ | return undef unless defined $string; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 537 | 0 | $string =~ s!\n+$!!g; | |||||||||||||||||||||||||||
| 538 | 0 | $string = "BEGIN:VEVENT\n${string}\nEND:VEVENT"; | |||||||||||||||||||||||||||
| 539 | 0 | my $vfile = Text::vFile::asData->new->parse_lines( split(/\n/, $string) ); | |||||||||||||||||||||||||||
| 540 | 0 | my $event = Data::ICal::Entry::Event->new(); | |||||||||||||||||||||||||||
| 541 | #return $event; | ||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||
| 543 | 0 | $event->parse_object($vfile->{objects}->[0]); | |||||||||||||||||||||||||||
| 544 | 0 | return $event->entries->[0]; | |||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||
| 546 | } | ||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||
| 548 | =head2 add_link <link> | ||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||
| 550 | Adds the link $link, which must be an XML::Atom::Link object, to the entry as a new <link> tag. For example: | ||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||
| 552 | my $link = XML::Atom::Link->new; | ||||||||||||||||||||||||||||
| 553 | $link->type('text/html'); | ||||||||||||||||||||||||||||
| 554 | $link->rel('alternate'); | ||||||||||||||||||||||||||||
| 555 | $link->href('http://www.example.com/2003/12/post.html'); | ||||||||||||||||||||||||||||
| 556 | $entry->add_link($link); | ||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||
| 558 | =cut | ||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||
| 560 | 0 | ▶ | sub add_link { | ||||||||||||||||||||||||||
|
Subroutine
add_link: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 561 | 0 | my ($self, $link) = @_; | |||||||||||||||||||||||||||
| 562 | # workaround bug in XML::Atom | ||||||||||||||||||||||||||||
| 563 | 0 | ▶ | $link = bless $link, 'XML::Atom::Link' if ref($link) && $link->isa('XML::Atom::Link'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $link and $link->isa("XML::Atom::Link")
MC/DC0%0/2
ref $link and $link->isa("XML::Atom::Link")
ref $link
$link->isa("XML::Atom::Link")
Truth table0%0/3
A and B
A= ref $linkB= $link->isa("XML::Atom::Link")
| |||||||||||||||||||||||||||||
| 564 | 0 | $self->SUPER::add_link($link); | |||||||||||||||||||||||||||
| 565 | } | ||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||
| 567 | =head2 original_event [event] | ||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||
| 569 | Get or set the original event ID. | ||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||
| 571 | =cut | ||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||
| 573 | 0 | ▶ | sub original_event { | ||||||||||||||||||||||||||
|
Subroutine
original_event: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 574 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 575 | 0 | return $self->_gd_element('originalEvent', @_); | |||||||||||||||||||||||||||
| 576 | } | ||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||
| 578 | =head1 TODO | ||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||
| 580 | =over 4 | ||||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||
| 582 | =item more complex content | ||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||
| 584 | =item more complex locations | ||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||
| 586 | =item recurrency | ||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||
| 588 | =item comments | ||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||
| 590 | =back | ||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||
| 592 | See http://code.google.com/apis/gdata/common-elements.html for details | ||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||
| 594 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 595 | |||||||||||||||||||||||||||||
| 596 | Simon Wistow <simon@thegestalt.org> | ||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||
| 598 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||
| 600 | Copyright Simon Wistow, 2006 | ||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||
| 602 | Distributed under the same terms as Perl itself. | ||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||
| 604 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||
| 606 | http://code.google.com/apis/gdata/common-elements.html | ||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||
| 608 | L<Net::Google::Calendar> | ||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||
| 610 | L<XML::Atom::Event> | ||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||
| 612 | =cut | ||||||||||||||||||||||||||||
| 613 | |||||||||||||||||||||||||||||
| 614 | |||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||
| 616 | 6 | 1; | |||||||||||||||||||||||||||