bageler has asked for the wisdom of the Perl Monks concerning the following question:
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:
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.print STDERR "FIRST $self->{template}\n"; my $xslt = XML::XSLT->new(Source => $self->{xslfile}); print STDERR "SECND $self->{template}\n";
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML::XSLT data garbling under mod_perl
by gellyfish (Monsignor) on Dec 07, 2004 at 09:27 UTC | |
by bageler (Hermit) on Dec 07, 2004 at 15:46 UTC | |
by gellyfish (Monsignor) on Dec 07, 2004 at 15:48 UTC | |
by bageler (Hermit) on Dec 08, 2004 at 01:49 UTC |