Skip Menu |

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

Report information
The Basics
Id: 14662
Status: new
Priority: 0/
Queue: XML-SAX-Machines

People
Owner: Nobody in particular
Requestors: emil.jansson [...] obigo.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.41
Fixed in: (no value)



Subject: Output files are not closed
my $machine = Pipeline( ..., '>' . $out_name ) );
From: emil.jansson [...] obigo.com
Ooops, submitted too early. It should be like this: Situation: a machine like this: my $machine = Pipeline( ..., '>' . $out_name ); where $out_name is the name of the output file. XML::SAX::Machine will put the output in the file, as requested. But! The file is never closed, so if one wants to read the file later, before Perl closes the file on exit, one have to flush open files, for example with this kludge: ``; The reason for the bug is (according to my investigations): The normal usage of XML::SAX::Writer would be to pass in a filename. XML::SAX::Writer will then open the file and also close it, in XML::SAX::Writer::FileConsumer::finalize() which is called by XML::SAX::Writer::XML::end_document. But on line 792-798 in XML/SAX/Machine.pm, the file is opened manually, and instead the file handle is passed to XML::SAX::Writer. XML::SAX::Writer will never close the file if it gets a file handle, which I think is right. In this case, XML::SAX::Machine should close the file, which it never does. So I think the bug should be fixed by either doing: 1. Pass the file name directly to XML::SAX::Writer and let it close the file. or 2. Ensure XML::SAX::Machine closes all files it has opened.