Every few requests my script would ISE and I tracked it down to where I pass the source xslt to a new XML::XSLT object.

First some overview:
self->{xslfile} is the xslt template
self->{template} is the data that will be parsed into the template.

Both parameters are filled in before running this snippet, and the glitch was only occassional. Here we go:

print STDERR "FIRST $self->{template}\n"; my $xslt = XML::XSLT->new(Source => $self->{xslfile}); print STDERR "SECND $self->{template}\n";
Later during the $xslt->serve(Source => $self->{template}) expat would intermittently complain about malformed XML document, always on the 56th byte, no matter what I did to the content before trying to output. Always worked fine when I ran the same content as a cgi.

The fix? instead of     my $xslt = XML::XSLT->new(Source =>  $self->{xslfile}); I changed to     my $xslt = XML::XSLT->new(Source =>  ($self->{xslfile})); That is, I wrapped $self->{xslfile} in parens.

Why did this happen? The offending version of XML::XSLT is 1.25, and it did not occur in version 1.20. There are some differences in the way internal XML::XSLT variables are set up, but I can't see anything that would be doing this outright.

My perl build:

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration: Platform: osname=freebsd, osvers=4.0-current, archname=i386-freebsd uname='FreeBSD freefall.FreeBSD.org 4.0-current FreeBSD 4.0-curren +t #0: $Date$' hint=recommended, useposix=true, d_sigaction=define usethreads=undef useperlio=undef d_sfio=undef Compiler: cc='cc', optimize='undef', gccversion=2.95.2 19991024 (release) cppflags='' ccflags ='' stdchar='char', d_stdstdio=undef, usevfork=true intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +2 alignbytes=4, usemymalloc=n, prototype=define Linker and Libraries: ld='cc', ldflags ='-Wl,-E -lperl -lm ' libpth=/usr/lib libs=-lm -lc -lcrypt libc=, so=so, useshrplib=true, libperl=libperl.so.3 Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' -Wl,-R/ +usr/lib' cccdlflags='-DPIC -fpic', lddlflags='-Wl,-E -shared -lperl -lm ' Characteristics of this binary (from libperl): Built under freebsd Compiled at May 25 2004 21:10:23 @INC: /usr/local/lib/perl5/site_perl/5.005/i386-freebsd /usr/local/lib/perl5/site_perl/5.005 . /usr/libdata/perl/5.00503/mach /usr/libdata/perl/5.00503

In reply to XML::XSLT data garbling under mod_perl by bageler

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.