You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have created a lexical output filehandle with the three-argument open() function. I haven't altered $|. I have passed this handle to an XML::Writer instance and after I am done with the XML creation I am calling the object method end(). I have not closed the filehandle explicitly because I am leaving a surrounding subroutine scope that should flush and close the filehandle. Unfortuntely the flush did not happen and the XML output was incomplete. Whatever is the real root cause of this phenomenon I am asking myself why end() does not call flush() on the output filehandle?!
I have added a flush() call to the $end code reference
my $end = sub {
$output->print("\n");
$output->flush();
return $selfcontained_output
if $use_selfcontained_output and defined wantarray;
};
and I have added an empty flush() implementation to the private XML::Writer::_String package
package XML::Writer::_String;
...
sub flush {}
This has solved my issue and the change has no negative impact on the XML::Writer unit tests.
PS: I have removed two $outputFile->flush(); statements from the t/01_main.t test script.
The text was updated successfully, but these errors were encountered:
I have created a lexical output filehandle with the three-argument
open()
function. I haven't altered$|
. I have passed this handle to anXML::Writer
instance and after I am done with the XML creation I am calling the object methodend()
. I have not closed the filehandle explicitly because I am leaving a surrounding subroutine scope that should flush and close the filehandle. Unfortuntely the flush did not happen and the XML output was incomplete. Whatever is the real root cause of this phenomenon I am asking myself whyend()
does not callflush()
on the output filehandle?!I have added a
flush()
call to the$end
code referenceand I have added an empty
flush()
implementation to the privateXML::Writer::_String
packageThis has solved my issue and the change has no negative impact on the
XML::Writer
unit tests.PS: I have removed two
$outputFile->flush();
statements from the t/01_main.t test script.The text was updated successfully, but these errors were encountered: