Subject: | warnings when parsing some (non-rdf?) rss files |
the attached patch eliminates a warning when parsing a non-RDF RSS file with warnings turned on.
$ perl -MXML::RSS -MLWP::Simple -w -e 'XML::RSS->new()->parse(get("http://export.cnet.com/export/feeds/news/e-business/rss/1,11330,,00.xml"))'
Use of uninitialized value in exists at /usr/share/perl5/XML/RSS.pm line 1432.
Use of uninitialized value in exists at /usr/share/perl5/XML/RSS.pm line 1432.
... repeated a bunch of times ...
$ perl -V
Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
Platform:
osname=linux, osvers=2.4.19, archname=i386-linux
uname='linux cyberhq 2.4.19 #1 smp sun aug 4 11:30:45 pdt 2002 i686 unknown '
config_args='-Dccflags=-DDEBIAN -Dcccdlflags=-fPIC -Darchname=i386-linux -Dprefix=/usr -Dprivlib=/usr/share/perl/5.6.1 -Darchlib=/usr/lib/perl/5.6.1 -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.6.1 -Dsitearch=/usr/local/lib/perl/5.6.1 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Uusesfio -Duseshrplib -Dlibperl=libperl.so.5.6.1 -Dd_dosuid -des'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
Compiler:
cc='cc', ccflags ='-DDEBIAN -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O2',
cppflags='-DDEBIAN -fno-strict-aliasing -I/usr/local/include'
ccversion='', gccversion='2.95.4 20011002 (Debian prerelease)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=4, usemymalloc=n, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lgdbm -ldb -ldl -lm -lc -lcrypt
perllibs=-ldl -lm -lc -lcrypt
libc=/lib/libc-2.2.5.so, so=so, useshrplib=true, libperl=libperl.so.5.6.1
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: USE_LARGE_FILES
Built under linux
Compiled at Nov 30 2002 17:31:55
@INC:
/usr/local/lib/perl/5.6.1
/usr/local/share/perl/5.6.1
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.6.1
/usr/share/perl/5.6.1
/usr/local/lib/site_perl
.
--- .cpan/build/XML-RSS-1.02/lib/RSS.pm Thu Feb 20 11:19:07 2003
+++ /usr/share/perl5/XML/RSS.pm Sun Feb 23 12:29:26 2003
@@ -1503,7 +1503,7 @@
$self->{'modules'}->{'http://purl.org/rss/1.0/modules/taxonomy/'} = 'taxo';
}
# beginning of a channel element that stores its info in rdf:resource
- elsif ( exists( $rdf_resource_fields{ $self->namespace($el) } ) and
+ elsif ( $self->namespace($el) && exists( $rdf_resource_fields{ $self->namespace($el) } ) and
exists( $rdf_resource_fields{ $self->namespace($el) }{ $el } ) and
$self->current_element eq 'channel' )
{
@@ -1523,7 +1523,7 @@
}
}
# beginning of an item element that stores its info in rdf:resource
- elsif ( exists( $rdf_resource_fields{ $self->namespace($el) } ) and
+ elsif ( $self->namespace($el) && exists( $rdf_resource_fields{ $self->namespace($el) } ) and
exists( $rdf_resource_fields{ $self->namespace($el) }{ $el } ) and
$self->current_element eq 'item' )
{