Skip Menu |

This queue is for tickets about the Net-CalDAVTalk CPAN distribution.

Report information
The Basics
Id: 130651
Status: resolved
Priority: 0/
Queue: Net-CalDAVTalk

People
Owner: Nobody in particular
Requestors: corion [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Net::CalDAVTalk->UpdateEvent() does not copy the event values
Due to what I guess is a refactoring, the properties of the old event do not get copied into the new, merged event anymore when calling ->_updateEvent(), which is called ->UpdateEvent(). This makes updating events using Net::CalDAVTalk hard. The attached test reproduces the problem. The fix is to change ub _updateEvent { my ($Self, $href, $Args) = @_; my $OldEvent = $Self->GetEvent($href); confess "Error getting old event for $href" unless $OldEvent; my %NewEvent; - foreach my $Property (keys %EventKeys) { + foreach my $Property (keys %{$EventKeys{''}}) { if (exists $Args->{$Property}) { if (defined $Args->{$Property}) { $NewEvent{$Property} = $Args->{$Property}; } } elsif (exists $OldEvent->{$Property}) { $NewEvent{$Property} = $OldEvent->{$Property}; } } # calculate updated sequence numbers unless (exists $Args->{sequence}) { $NewEvent{sequence} = ($OldEvent->{sequence} || 0) + 1; }
Subject: net-caldavtalk-updateevent.t
#!perl use strict; use warnings; use Net::CalDAVTalk; use Test::More tests => 1; my $merged_result = { 'sequence' => 1, 'href' => '/myuid', 'uid' => '2DDB4067-42FF-xxxx-xxxx-xxxxxxxx', 'duration' => 'PT14H25M', 'prodId' => '-//NP4GmbH//PCSOffice//EN', 'title' => 'title', 'start' => '2020-01-01T16:40:00', 'locations' => { 'location' => { 'name' => 'Here (old)' } }, 'timeZone' => 'Etc/UTC', 'updated' => '2019-09-24T07:10:12Z', 'created' => '2019-09-24T07:10:12Z', 'isAllDay' => bless( do{\(my $o = 0)}, 'JSON::PP::Boolean' ), 'description' => 'Random new description' }; my $old = { %$merged_result }; $old->{description} = 'Random old description'; # Fake data so we don't need a network connection or a real server sub Net::CalDAVTalk::GetEvent { my( $self, $href ) = @_; die "Mock sub called for wrong value '$href'" unless $href eq '/myuid'; return $old; }; my $event = { %$merged_result }; $event->{locations}->{location} = 'There (new)'; my $caldav = bless {}, 'Net::CalDAVTalk'; my $new_event = $caldav->_updateEvent('/myuid', $event); is_deeply $new_event, $merged_result;
Now, looking at Github, the fix is already there: https://github.com/tadzik/Net-CalDAVTalk/commit/a1189c8128922ff9f51a1fabd994e3e4facfeca7 This seems to have been also reported in RT#124198, and I misread that ticket. Sorry for the noise.
... duplicate