Skip Menu |

This queue is for tickets about the XML-Simple CPAN distribution.

Report information
The Basics
Id: 20485
Status: resolved
Priority: 0/
Queue: XML-Simple

People
Owner: Nobody in particular
Requestors: mschwern [...] cpan.org
nospam-abuse [...] bloodgate.com
Cc:
AdminCc:

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



Subject: fails the testsuite
# make test cp lib/XML/Simple/FAQ.pod blib/lib/XML/Simple/FAQ.pod cp lib/XML/Simple.pm blib/lib/XML/Simple.pm PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t # Package Version # perl 5.8.8 # XML::Simple 2.14 # Storable 2.15 # XML::Parser 2.34 # XML::SAX 0.14 # XML::NamespaceSupport 1.09 # XML::SAX::PurePerl 0.90 (default parser) t/0_Config........ok t/1_XMLin.........ok 1/122Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96. Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96. Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96. Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96. Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96. Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96. Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96. Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96. Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96. Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96. Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96. t/1_XMLin.........ok 2/122Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96. Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96. Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96. Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96. Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96. Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96. Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96. Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96. Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96. # Failed test 'no warning issued (as expected)' # in t/1_XMLin.t at line 380. # got: 'Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96. # ' # expected: '' Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96. Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96, <STDIN> line 1. Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96, <STDIN> line 1. t/1_XMLin.........NOK 32Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96, <STDIN> line 1. Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96, <STDIN> line 1. Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96, <STDIN> line 1. Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96, <STDIN> line 1. Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96, <STDIN> line 1. Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96, <STDIN> line 1. # Failed test 'successfully read an SRT config file' # in t/1_XMLin.t at line 1443. # Structures begin differing at: # $got->{pubpath}{test1}{title} = 'web_source -> web_target1' # $expected->{pubpath}{test1}{title} = 'web_source -&gt; web_target1' # Looks like you failed 2 tests of 122. t/1_XMLin.........dubious Test returned status 2 (wstat 512, 0x200) DIED. FAILED tests 32, 122 Failed 2/122 tests, 98.36% okay t/2_XMLout........ok 1/196 # Failed test 'generated document with escaping' # in t/2_XMLout.t at line 302. # Structures begin differing at: # $got->{c} = '&amp;C&amp;' # $expected->{c} = '&C&' t/2_XMLout........NOK 47Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96. Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96. Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96. # Looks like you failed 1 test of 196. t/2_XMLout........dubious Test returned status 1 (wstat 256, 0x100) DIED. FAILED test 47 Failed 1/196 tests, 99.49% okay (less 1 skipped test: 194 okay, 98.98%) t/3_Storable......ok t/4_MemShare......ok t/5_MemCopy.......ok t/6_ObjIntf.......ok t/7_SaxStuff......ok t/8_Namespaces....ok t/9_Strict........ok 1/38Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96. Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96. Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96. Unable to recognise encoding of this document at /usr/lib/perl5/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96. t/9_Strict........ok t/A_XMLParser.....ok Failed Test Stat Wstat Total Fail Failed List of Failed ------------------------------------------------------------------------------- t/1_XMLin.t 2 512 122 2 1.64% 32 122 t/2_XMLout.t 1 256 196 1 0.51% 47 1 subtest skipped. Failed 2/11 test scripts, 81.82% okay. 3/468 subtests failed, 99.36% okay. make: *** [test_dynamic] Error 255 Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Platform: osname=linux, osvers=2.6.16, archname=x86_64-linux-thread-multi uname='linux dvorak 2.6.16 #1 smp mon apr 10 04:51:13 utc 2006 x86_64 x86_64 x86_64 gnulinux ' config_args='-ds -e -Dprefix=/usr -Dvendorprefix=/usr -Dinstallusrbinperl -Dusethreads -Di_db -Di_dbm -Di_ndbm -Di_gdbm -Duseshrplib=true -Doptimize=-O2 -fmessage-length=0 -Wall -D_FORTIFY_SOURCE=2 -g -Wall -pipe' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=define use64bitall=define uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -pipe -Wdeclaration-after-statement -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2 -fmessage-length=0 -Wall -D_FORTIFY_SOURCE=2 -g -Wall -pipe', cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -pipe -Wdeclaration-after-statement' ccversion='', gccversion='4.1.0 (SUSE Linux)', gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib64' libpth=/lib64 /usr/lib64 /usr/local/lib64 libs=-lm -ldl -lcrypt -lpthread perllibs=-lm -ldl -lcrypt -lpthread libc=/lib64/libc-2.4.so, so=so, useshrplib=true, libperl=libperl.so gnulibc_version='2.4' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/lib/perl5/5.8.8/x86_64-linux-thread-multi/CORE' cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib64' Characteristics of this binary (from libperl): Compile-time options: DEBUGGING MULTIPLICITY PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP THREADS_HAVE_PIDS USE_64_BIT_ALL USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API Built under linux Compiled at Apr 22 2006 23:33:01 @INC: /usr/lib/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 /usr/lib/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl . Using built-in specs. Target: x86_64-suse-linux Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,java,ada --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.1.0 --enable-ssp --disable-libssp --enable-java-awt=gtk --enable-gtk-cairo --disable-libjava-multilib --with-slibdir=/lib64 --with-system-zlib --enable-shared --enable-__cxa_atexit --enable-libstdcxx-allocator=new --without-system-libunwind --with-cpu=generic --host=x86_64-suse-linux Thread model: posix gcc version 4.1.0 (SUSE Linux)
From: GRANTM [...] cpan.org
Thank you for the report, however this is not a bug with XML::Simple, but with XML::SAX::PurePerl which is apparently the default parser on your system. I have supplied patches to the maintainer of XML::SAX but they have not been applied yet. Even if this problem did not exist in XML::SAX::PurePerl, you probably still wouldn't want to use it for performance reasons. The simplest workaround is to install XML::SAX::Expat which will register itself as the default SAX parser. The XML::Simple test suite should then run without error. Even though this is not a bug with XML::Simple, I am going to leave this ticket open in the hope that people will see it and stop submitting duplicate reports.
Subject: Re: [rt.cpan.org #20485] fails the testsuite
Date: Sun, 16 Jul 2006 23:51:15 +0200
To: bug-XML-Simple [...] rt.cpan.org
From: Tels <nospam-abuse [...] bloodgate.com>
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Moin, On Sunday 16 July 2006 23:09, via RT wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=20485 > > > Thank you for the report, however this is not a bug with XML::Simple, > but with XML::SAX::PurePerl which is apparently the default parser on > your system. I have supplied patches to the maintainer of XML::SAX but > they have not been applied yet. > > Even if this problem did not exist in XML::SAX::PurePerl, you probably > still wouldn't want to use it for performance reasons. The simplest > workaround is to install XML::SAX::Expat which will register itself as > the default SAX parser. The XML::Simple test suite should then run > without error.
Maybe you should make your module not try the testsuite when you know that the installed dependency is known to be broken :-) Show quoted text
> Even though this is not a bug with XML::Simple, I am going to leave this > ticket open in the hope that people will see it and stop submitting > duplicate reports.
Thanx for the response. I just wanted to install XML::Simple because it is used by Image::Info for SVG parsing. (and I want to get rid of that dependency, but needed tests before what the code actually does). This complication and the multiple dependencies it has have strengthen my decision to remove the dependency on XML::Simple. All the best, Tels - -- Signed on Sun Jul 16 23:47:38 2006 with key 0x93B84C15. Visit my photo gallery at http://bloodgate.com/photos/ PGP key on http://bloodgate.com/tels.asc or per email. "Blogebrity: Wow, guess what this one stands for? Too easy. Hey, anyone can do it: take a blogger who's a chef, and you get: BLEF. A blogger who's a dentist? BENTIST. A female blogger with an itch? You guessed it: a BITCH." -- maddox from xmission -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iQEVAwUBRLq05HcLPEOTuEwVAQJtjQf9Hu93BWQGZm+7oUp/FxgdGljS/a/u+AHr wG8dSB+FBG2C4+QX1dUvw15ypEbZK7iid+X15Bcr91Ibf5tec9dei+4Q+oyNzifI zzbYGu7JsqDxazZIxN1Y3u4XM3bIlz2zyaKIwBVEPXJuf/s3FlxTaaK3ecHs2v36 8N+j77Il/TTt9P65gVuTeMMpgiNDi7XqzDNa31bEpLYU7LgNGEEmi248ohjl1vUa LW7AvFUUdJm6xpRc8tCoj0fZzL5aqpZvwxPQ8mEn66ui6U94+qemHgqo7LwXo9Jd gpVdUI0CcdOQXO28+6c0u9Dmiv7aR8bpifGh9aw33AqvmeHXRMV7DA== =2BDF -----END PGP SIGNATURE-----
On Sun Jul 16 17:50:58 2006, nospam-abuse@bloodgate.com wrote: Show quoted text
> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Moin, > > On Sunday 16 July 2006 23:09, via RT wrote:
> > <URL: http://rt.cpan.org/Ticket/Display.html?id=20485 > > > > > Thank you for the report, however this is not a bug with XML::Simple, > > but with XML::SAX::PurePerl which is apparently the default parser
I'd just add that I tried editing the Makefile.PL to ignore my installed XML::SAX in preference to my also installed XML::Parser but the tests didn't seem to take note of that. # Disable XML::SAX. Failover to XML::Parser... if ( 0 && eval { require XML::SAX } && ! $@ ) { Josh
From: GRANTM [...] cpan.org
On Tue Jul 18 18:42:07 2006, JJORE wrote: Show quoted text
> I'd just add that I tried editing the Makefile.PL to ignore my installed > XML::SAX in preference to my also installed XML::Parser but the tests > didn't seem to take note of that. > > # Disable XML::SAX. Failover to XML::Parser... > if ( 0 && eval { require XML::SAX } && ! $@ ) {
I'm not sure what you expect that to do. XML::Simple will always determine which parser to use at run time (as documented in the POD in the section entitled ENVIRONMENT). All the Makefile.PL is trying to do is make sure that you have at least one parser module installed. If you subsequently change your system default parser then XML::Simple will use the new one without needing to be reinstalled.
Subject: Unable to recognise encoding of this document at .../XML/SAX/PurePerl/EncodingDetect.pm line 96.
The XML::Simple tests are failing with lots of: t/1_XMLin.........ok 1/122Unable to recognise encoding of this document at /usr/local/lib/site_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96. and t/2_XMLout........NOK 47# Failed test 'generated document with escaping' # in t/2_XMLout.t at line 302. # Structures begin differing at: # $got->{c} = '&amp;C&amp;' # $expected->{c} = '&C&' I am using XML::SAX 0.14 and XML::NamespaceSupport 1.09 on a freshly built perl 5.8.8. With a handful of irrelevant exceptions, everything is up to date. Package namespace installed latest in CPAN file Class::Accessor::Fast undef 0.25 KASEI/Class-Accessor-0.25.tar.gz Jifty::DBI::Collection::Union undef 0 JESSE/Jifty-DBI-0.23.tar.gz Math::Complex 1.35 1.36 JHI/Math-Complex-1.36.tar.gz Sys::Syslog 0.13 0.18 SAPER/Sys-Syslog-0.18.tar.gz Text::Balanced 1.95 1.98 DCONWAY/Text-Balanced-1.98.tar.gz Tie::RefHash 1.32 1.34 NUFFIN/Tie-RefHash-1.34.tar.gz threads 1.07 1.38 JDHEDDEN/threads-1.38.tar.gz
Subject: test.out
Download test.out
application/octet-stream 6.5k

Message body not shown because it is not plain text.

Subject: perl_V.txt
Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Platform: osname=darwin, osvers=8.7.1, archname=darwin-thread-multi-2level uname='darwin windhund.local 8.7.1 darwin kernel version 8.7.1: wed jun 7 16:19:56 pdt 2006; root:xnu-792.9.72.obj~2release_i386 i386 i386 ' config_args='-Dprefix=/usr/local/perl/5.8.8 -Dccflags=-I/sw/include -Dldflags=-L/sw/lib -Dperladmin=schwern@pobox.com -Uinstallusrbinperl -Duseithreads' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-I/sw/include -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/opt/local/include', optimize='-O3', cppflags='-no-cpp-precomp -I/sw/include -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/opt/local/include' ccversion='', gccversion='4.0.1 (Apple Computer, Inc. build 5363)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags ='-L/sw/lib -L/usr/local/lib' libpth=/usr/local/lib /sw/lib /usr/lib libs=-lgdbm -ldbm -ldb -ldl -lm -lc perllibs=-ldl -lm -lc libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false, libperl=libperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-L/sw/lib -bundle -undefined dynamic_lookup -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API Built under darwin Compiled at Sep 5 2006 03:01:50 %ENV: PERL5LIB="/sw/lib/perl5:/sw/lib/perl5/darwin" @INC: /sw/lib/perl5 /sw/lib/perl5/darwin /usr/local/perl/5.8.8/lib/darwin-thread-multi-2level /usr/local/perl/5.8.8/lib /usr/local/lib/site_perl/5.8.8/darwin-thread-multi-2level /usr/local/lib/site_perl/5.8.8 /usr/local/lib/site_perl .
I'm going to add a "me too" to Tels' assertion that if XML::SAX::PurePerl is busted for XML::Simple then it shouldn't depend on it. I'll whip up the necessary Makefile.PL magic.
Subject: [PATCH]
Here ya go. This will make it not use XML::SAX if only PurePerl is available.
=== Makefile.PL ================================================================== --- Makefile.PL (revision 17952) +++ Makefile.PL (local) @@ -27,20 +27,8 @@ print "Checking installed modules ...\n"; -if ( eval { require XML::SAX } && ! $@ ) { - print "XML::SAX is installed, it will be used by the test suite\n"; - $make_params->{PREREQ_PM}->{'XML::SAX'} = 0; - $make_params->{PREREQ_PM}->{'XML::NamespaceSupport'} = 1.04; -} -elsif ( eval { require XML::Parser } && ! $@ ) { - print "XML::Parser is installed, it will be used by the test suite\n"; - $make_params->{PREREQ_PM}->{'XML::Parser'} = 0; -} -else { - print "You don't have either XML::SAX or XML::Parser installed!\n"; - $make_params->{PREREQ_PM}->{'XML::SAX'} = 0; - $make_params->{PREREQ_PM}->{'XML::NamespaceSupport'} = 1.04; -} +my $prereq = $make_params->{PREREQ_PM}; +%$prereq = (%$prereq, find_xml_prereq()); eval { require Storable }; if($@) { @@ -49,3 +37,33 @@ WriteMakefile(%$make_params); + + +sub find_xml_prereq { + if ( eval { require XML::SAX } ) { + my $parsers = XML::SAX->parsers; + if( @$parsers == 1 and $parsers->[0]{Name} eq 'XML::SAX::PurePerl' ) { + print <<'END_XML_SAX'; +XML::SAX::PurePerl is the only XML::SAX backend installed. + It has incompatible bugs and cannot be used by XML::Simple. +END_XML_SAX + } + else { + print "XML::SAX is installed, it will be used by the test suite\n"; + return ( + 'XML::SAX' => 0, + 'XML::NamespaceSupport' => 1.04 + ); + } + } + + if ( eval { require XML::Parser } ) { + print "XML::Parser is installed, it will be used by the test suite\n"; + return ( 'XML::Parser' => 0 ); + } + + print "You don't have either XML::SAX or XML::Parser installed!\n"; + return ( 'XML::SAX' => 0, + 'XML::NamespaceSupport' => 1.04 + ); +} === lib/XML/Simple.pm ================================================================== --- lib/XML/Simple.pm (revision 17952) +++ lib/XML/Simple.pm (local) @@ -54,7 +54,8 @@ @EXPORT = qw(XMLin XMLout); @EXPORT_OK = qw(xml_in xml_out); $VERSION = '2.14'; -$PREFERRED_PARSER = undef; +$PREFERRED_PARSER = $ENV{XML_SIMPLE_PREFERRED_PARSER} || + __PACKAGE__->_working_XML_SAX ? '' : 'XML::Parser'; my $StrictMode = 0; my %CacheScheme = ( @@ -82,6 +83,16 @@ my $bad_def_ns_jcn = '{' . $xmlns_ns . '}'; # LibXML::SAX workaround +sub _working_XML_SAX { + my $class = shift; + + return unless eval { require XML::SAX; }; + + my $parsers = XML::SAX->parsers; + return (@$parsers == 1 and $parsers->[0]{Name} eq 'XML::SAX::PurePerl') ? 0 : 1; +} + + ############################################################################## # Globals for use by caching routines # @@ -263,9 +274,6 @@ my $preferred_parser = $PREFERRED_PARSER; - unless(defined($preferred_parser)) { - $preferred_parser = $ENV{XML_SIMPLE_PREFERRED_PARSER} || ''; - } if($preferred_parser eq 'XML::Parser') { return($self->build_tree_xml_parser($filename, $string)); } @@ -281,7 +289,7 @@ $XML::SAX::ParserPackage = $preferred_parser if($preferred_parser); my $sp = XML::SAX::ParserFactory->parser(Handler => $self); - + $self->{nocollapse} = 1; my($tree); if($filename) {
From: GRANTM [...] cpan.org
On Tue Sep 05 14:14:51 2006, MSCHWERN wrote: Show quoted text
> I'm going to add a "me too" to Tels' assertion that if > XML::SAX::PurePerl is busted for XML::Simple then it shouldn't > depend on it.
Hi Michael I feel like I'm in some crazy parallel universe where logic and reason work in ways I don't understand. I agree 100% that XML::Simple should not declare a dependency on a module that's busted. But XML::SAX::PurePerl wasn't busted in 2003 when I set up that dependency. I don't understand why I'm even involved in this conversation. The problem that exists right now is with XML::SAX::PurePerl. I have provided a patch to the maintainer and a simple workaround to anyone that needs XML::Simple to work (just install XML::SAX::Expat). XML::SAX::PurePerl prior to version 0.13 was a fine module. Hopefully the next release will be good too. I fail to see why patching XML::Simple so that it refuses to work with any version of XML::SAX::PurePerl, is a good idea. If you want to help fix the problem, perhaps you'd like to give Matt a gentle nudge? Cheers Grant P.S. I hope you don't misinterpret the tone here - I'm not grumpy, I'm just confused.
CC: MSCHWERN [...] cpan.org, nospam-abuse [...] bloodgate.com
Subject: Re: [rt.cpan.org #20485] fails the testsuite
Date: Wed, 06 Sep 2006 17:45:58 -0400
To: bug-XML-Simple [...] rt.cpan.org
From: Michael G Schwern <schwern [...] gmail.com>
via RT wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=20485 > > On Tue Sep 05 14:14:51 2006, MSCHWERN wrote:
>> I'm going to add a "me too" to Tels' assertion that if >> XML::SAX::PurePerl is busted for XML::Simple then it shouldn't >> depend on it.
> > I feel like I'm in some crazy parallel universe where logic and reason > work in ways I don't understand.
Let's look at it from the user's perspective. That might make it clear. The user wants to install a module. Let's call it Jifty. Jifty depends on XML::Simple. User goes into CPAN with a clean Perl and types "install Jifty". CPAN does its thing installing dependencies. XML::Simple's tests fail. XML::Simple does not install. Jifty's installation fails. User reports the problem to XML::Simple, since that's where it appears the problem is. User also reports to Jifty that it didn't install because one of the dependencies wouldn't install. The user cannot use Jifty. Now from the Jifty developer side. Jifty developers start getting reports from users that they can't install a dependency. Jifty developers now have two choices... A) get XML::Simple fixed B) drop the dependency on XML::Simple So you see from a user and dependent module developer perspective, XML::SAX::PurePerl, the real problem, doesn't come into it at all. Jifty depends on XML::Simple and expects it to just work. You now have two choices. A) get XML::SAX::PurePerl fixed. B) drop the dependency on XML::SAX::PurePerl You've tried A. Now its time for B. There is always C) leave it broken and deal with the redundant bug reports. But that seems to be driving you nuts. Dependency breakage breaks things up the dependency chain. Then the problem comes crashing back down the chain again. I realize you didn't break anything, but that doesn't change the fact that XML::Simple won't install. The user doesn't care who broke what, they just want it fixed. I have to deal with this sort of thing all the time in MakeMaker and Test::More routing around broken things in old perls and crappy implementations of make. Since I'm the one requesting the fix I went ahead and provided a patch so you have to do as little work as possible. Show quoted text
> I agree 100% that XML::Simple should not declare a dependency on a > module that's busted. But XML::SAX::PurePerl wasn't busted in 2003 > when I set up that dependency.
Its now 2006. Things change. Things sometimes break. :( Show quoted text
> The problem that exists right now is with XML::SAX::PurePerl. I have > provided a patch to the maintainer and a simple workaround to anyone > that needs XML::Simple to work (just install XML::SAX::Expat).
The problem is that automated building of large wads of CPAN modules is broken. Such as when installing something large like Jifty. Manually having to figure out what's wrong and how to fix it discourages people from installing things which depend on XML::Simple. Its gotta work out of the box. Also there's no mention of this in the README. Show quoted text
> XML::SAX::PurePerl prior to version 0.13 was a fine module. > Hopefully the next release will be good too. I fail to see why > patching XML::Simple so that it refuses to work with any version of > XML::SAX::PurePerl, is a good idea.
Once PurePerl is fixed just release a new XML::Simple that does work with PurePerl. Until then its better than a broken module. And no more redundant bug reports! I considered making it only skip the 0.13 - 0.14 PurePerl versions and assume that the next one will have a fix, but I see that there's been a release since you reported the bug (reported in 0.13 and not fixed in 0.14) and didn't want to add a dodgy assumption like that. Show quoted text
> If you want to help fix the problem, perhaps you'd like to give Matt > a gentle nudge?
FWIW I added a "me, too" to the ticket.
Subject: Re: [rt.cpan.org #20485] fails the testsuite
Date: Thu, 7 Sep 2006 07:04:06 +0200
To: bug-XML-Simple [...] rt.cpan.org
From: Tels <nospam-abuse [...] bloodgate.com>
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Moin, On Wednesday 06 September 2006 23:46, Michael G Schwern via RT wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=20485 > > via RT wrote:
> > <URL: http://rt.cpan.org/Ticket/Display.html?id=20485 > > > > > On Tue Sep 05 14:14:51 2006, MSCHWERN wrote:
> >> I'm going to add a "me too" to Tels' assertion that if > >> XML::SAX::PurePerl is busted for XML::Simple then it shouldn't > >> depend on it.
> > > > I feel like I'm in some crazy parallel universe where logic and reason > > work in ways I don't understand.
> > Let's look at it from the user's perspective. That might make it clear.
[snipabit] I agree with Michael. It's the age-old thing I am preaching now and then on perl-qa: If you save yourself work by re-using other people's work, you open up yourself to problems of breakage in third-party code. That is one reason of why an author should reduce the required dependencies to a minimum - KISS. The less dependecies, the less complexity, the less things can break. FITW, a breaking XML::Simple breaks Image::Info. (Thats why I want to get rid of that dependecy altogther, just haven't seen how I could do this easily :) all the best, tels - -- Signed on Thu Sep 7 07:01:14 2006 with key 0x93B84C15. Visit my photo gallery at http://bloodgate.com/photos/ PGP key on http://bloodgate.com/tels.asc or per email. Mediawiki graph-extension: http://bloodgate.com/perl/graph/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iQEVAwUBRP+oT3cLPEOTuEwVAQIZdQf/VL9Vjg+WWW1qZwzCeAhCpL2toCxt3bH6 oJCnGEb0HMn/UjpK2OfmIQz3L+upvAtPId/enfD6WZGCnyjLgEiAo4iCyckI9k/W O9bnynZF4DOTZx4S3vEBkH9Hv9I51tvLXxCaFtZJZcZUmO/IOO7+6VGDvs/Cm2XC yvUwnBoEguDTfsFoGszYEJuoSPsaQ4Oq6Zo1y4VOtgrel72D5ZKOf9wWVUVs7330 6EEqHkRE8AjIcHVTYe4PZJckGBeuyblX62hzjSHB1Jmoimp7Si/F6/yzid3vvoMy neCpiZGXcCtrq6Y1B7mIr28Qh+Gau4HngHW7GsKy1N3Xa8mBkKgy+g== =hIRP -----END PGP SIGNATURE-----
Fixed in release 2.15 (03-Oct-06). If no parser is installed, dependencies should automatically resolve to XML::SAX::Expat. If/when XML::SAX::PurePerl is fixed, I'll swap the dependency back so that no compiler is required.