in reply to Re^2: Fastest XML parser that can run under ActivePerl on Windows?
in thread Fastest XML parser that can run under ActivePerl on Windows?

I can replicate the problem with Perl 5.10.0 (it's fine with 5.8.8).  The respective snippet is (with the debug line added):

my $ver = $]*1000; # correct for possibile division problems print "\$]=$], \$ver=$ver\n"; # debug my ($major,$minor,$sub) = unpack("AA3xA3","$ver");

Output 5.8.8:

$]=5.008008, $ver=5008.008

Output 5.10.0:

$]=5.010000, $ver=5010 'x' outside of string in unpack at ./760220.pl line 10.

(note the missing .XXX part in $ver, which makes unpack() complain)

Apparently, this has never been tried with a .0 release...   (Update: bug reported)

Replies are listed 'Best First'.
Re^4: Fastest XML parser that can run under ActivePerl on Windows?
by syphilis (Archbishop) on Apr 27, 2009 at 03:06 UTC
    Apparently, this has never been tried with a .0 release...

    I've just tried this with a number of Win32 perl-5.10.0 installations, and can't reproduce the problem, as the offending code is not executed (because has_cc() is true).

    Incidentally, if using a Microsoft compiler you may need this patch to Bare.xs:
    --- Bare.xs_orig Mon Apr 27 12:34:29 2009 +++ Bare.xs Mon Apr 27 13:00:50 2009 @@ -97,13 +97,13 @@ if( SvTYPE( SvRV(*cur) ) == SVt_PVHV ) { AV *newarray = newAV(); SV *newarrayref = newRV_noinc( (SV *) newarray ); - + + SV *ob = cxml2obj(); SV *newref = newRV( (SV *) SvRV( *cur ) ); - + hv_delete( output, curnode->name, curnode->namelen, 0 ); hv_store( output, curnode->name, curnode->namelen, newarray +ref, 0 ); av_push( newarray, newref ); - SV *ob = cxml2obj(); av_push( newarray, ob ); } else { @@ -141,7 +141,9 @@ int numatts = curnode->numatt; SV *attval; SV *attatt; - + HV *output = newHV(); + SV *outputref = newRV( (SV *) output ); + int length = curnode->numchildren; if( ( length + numatts ) == 0 ) { if( curnode->vallen ) { @@ -151,9 +153,6 @@ return newSViv( 1 ); //&PL_sv_undef; } - HV *output = newHV(); - SV *outputref = newRV( (SV *) output ); - if( length ) { curnode = curnode->firstchild; for( i = 0; i < length; i++ ) { @@ -273,6 +272,9 @@ c_parsefile(filename) char * filename CODE: + char *data; + unsigned long len; + FILE *handle; PERL_HASH(vhash, "value", 5); PERL_HASH(ahash, "_att", 4); PERL_HASH(chash, "comment", 7); @@ -280,9 +282,6 @@ PERL_HASH(ihash, "_i", 2 ); PERL_HASH(zhash, "_z", 2 ); PERL_HASH(cdhash, "_cdata", 6 ); - char *data; - unsigned long len; - FILE *handle; handle = fopen(filename,"r"); fseek( handle, 0, SEEK_END );
    (I'll report that, too - if I don't forget.)

    Cheers,
    Rob