Skip Menu |

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

Report information
The Basics
Id: 6232
Status: resolved
Priority: 0/
Queue: XML-Writer

People
Owner: Nobody in particular
Requestors: mathieu.rt.cpan [...] closetwork.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.5
Fixed in: 0.510



Subject: output buffering issues when using default output
I encountered some buffering weirdness with XML::Writer when using the default output (i.e. not specifying an output at all). My CGI was doing something like this: print "Content-type: text/xml\n\n"; my $x = new XML::Writer(); $x->xmlDecl(); ... $x->end; And the content-type line would end up at the end of the XML. Anyway, the fix is as follow: diff -u -r1.1 Writer.pm --- Writer.pm 5 May 2004 16:34:46 -0000 1.1 +++ Writer.pm 5 May 2004 16:37:58 -0000 @@ -427,11 +427,7 @@ my $newOutput = $_[0]; # If there is no OUTPUT parameter, # use standard output - unless ($newOutput) { - $newOutput = new IO::Handle(); - $newOutput->fdopen(fileno(STDOUT), "w") || - croak("Cannot write to standard output: $!"); - } + $newOutput ||= \*STDOUT; $output = $newOutput; }; Note that this might not work in earlier version of Perl. You probably should change all the $output->print(xxx) to print $output xxx. Thanks for writing this module. -Mathieu
Thanks - I've made this fix in 0.510.