Subject: | Adding WebContent to Calendar Entries fails with 404 |
Date: | Fri, 21 Dec 2007 19:18:22 -0800 |
To: | Bugs in Net-Google-Calendar via RT <bug-Net-Google-Calendar [...] rt.cpan.org> |
From: | James Wright <jamesw [...] bsdhosting.co.za> |
When adding a Webcontent link to a Net::Google::Calendar::Entry, the
gCal namespace is not added, this results in Google returning a less
than helpful 404 error message.
This patch adds namespace to the WebContent function and prepends
'gCal:' to the child nodes that get added for GadgetPrefs.
--- lib/Net/Google/Calendar/WebContent.pm.orig Wed Dec 19 13:31:25 2007
+++ lib/Net/Google/Calendar/WebContent.pm Fri Dec 21 19:12:40 2007
@@ -119,7 +119,8 @@
sub webContent {
my $self = shift;
- my $name = 'gcal:webContent';
+ my $gcal_ns = $ns;
+ my $name = 'webContent';
if (@_) {
my %params = @_;
# h-h-hack
@@ -128,24 +129,24 @@
$self->_set_type($type);
}
my $prefs = delete $params{prefs};
- XML::Atom::Base::set($self, '', $name, '', \%params);
- my $content = $self->_my_get('', $name);
+ XML::Atom::Base::set($self, $gcal_ns, $name, '', \%params);
+ my $content = $self->_my_get($gcal_ns, $name);
foreach my $key (keys %{$prefs}) {
# TODO: this feels icky
my $node;
if (LIBXML) {
- $node = XML::LibXML::Element->new($name.'GadgetPref');
+ $node = XML::LibXML::Element->new('gCal:'.$name.'GadgetPref');
$node->setAttribute( Name => $key );
$node->setAttribute( Value => $prefs->{$key} );
} else {
- $node = XML::XPath::Node::Element->new($name.'GadgetPref');
+ $node = XML::XPath::Node::Element->new('gCal:'.$name.'GadgetPref');
$node->addAttribute(XML::XPath::Node::Attribute->new(Name => $key));
$node->addAttribute(XML::XPath::Node::Attribute->new(Value => $prefs->{key}));
}
$content->appendChild($node);
}
}
- return $self->_my_get('', $name);
+ return $self->_my_get($gcal_ns, $name);
}
1;