Subject: | Getting objects, hoping for scalars |
It's been a while since the last release of this code, and I saw in some
other bug reports that you've been waiting on a new release of XML::Atom
(or one of its children) to release a new version of your code.
Maybe that's happened and you haven't had time to roll up a new version
of this module. Anyway, I installed this module from CPAN and it seems
to be returning objects (like XML::Atom::Entry, XML::Atom::Person)
instead of string scalars which was kind of what I was expecting to get.
So I made a patch to fix up some of those things. I left the author and
content methods returning an object, though.
Subject: | Net-Google-Calendar-return-scalar.patch |
--- Entry.pm 2007-04-16 02:20:11.000000000 -0500
+++ /Library/Perl/5.8.6/Net/Google/Calendar/Entry.pm 2007-10-23 11:34:07.000000000 -0500
@@ -145,8 +145,15 @@
$self->set($self->{_gd_ns}, "gd:${elem}", '', { value => "http://schemas.google.com/g/2005#event.${val}" });
return $val;
}
- my $val = $self->_my_get($self->{_gd_ns}, $elem, 'value');
- $val =~ s!^http://schemas.google.com/g/2005#event\.!!;
+ my $val;
+ my $node = $self->_my_get($self->{_gd_ns}, $elem, 'value');
+ if ( defined $node ) {
+ if ( $node->hasAttribute( 'value' ) ) {
+ $val = $node->getAttribute( 'value' );
+ }
+ $val =~ s!^http://schemas.google.com/g/2005#event\.!!;
+ }
+
return $val;
}
@@ -165,7 +172,13 @@
return $val;
}
- return $self->_my_get($self->{_gd_ns}, 'where', 'valueString');
+ my $loc = $self->_my_get($self->{_gd_ns}, 'where', 'valueString');
+ if ( defined $loc ) {
+ if ( $loc->hasAttribute('valueString') ) {
+ return $loc->getAttribute('valueString');
+ }
+ }
+ return $loc;
}
# work round get in XML::Atom::Thing which stringifies stuff
@@ -229,7 +242,7 @@
push @rets, $start;
}
} else {
- die "No start date ".$self->as_xml;
+ warn "No start date ".$self->as_xml;
}
if (defined $end) {
if ($start->hasAttribute('endTime')) {