Skip Menu |

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

Report information
The Basics
Id: 58190
Status: resolved
Priority: 0/
Queue: XML-LibXML

People
Owner: Nobody in particular
Requestors: dcardwell [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.70
Fixed in: (no value)



Subject: ->load_xml and XML::LibXML::InputCallback
I recently upgraded to XML::LibXML 1.70 and noticed the addition of the ->load_xml method. When using this in conjunction with the `location` parameter to load an external file it seems to ignore the InputCallback that was previously working fine with the ->parse_file method. I have attached a short test case to this e-mail. When the file is read in with ->parse_file a warning is generated in the InputCallback, however the warning is not triggered with - Show quoted text
>load_xml. Should it be, or am I missing something?
Subject: testcase.pl
#!/usr/bin/perl -wT use strict; use warnings; use XML::LibXML; die 'This test case is for XML::LibXML v1.70' unless $XML::LibXML::VERSION eq '1.70'; my $input_callbacks = XML::LibXML::InputCallback->new(); $input_callbacks->register_callbacks([ sub { 1 }, sub { warn 'Input callback used'; open my $fh, '<', shift; return $fh; }, sub { my $buffer; read(shift, $buffer, shift); return $buffer; }, sub { close shift }, ]); my $xml_parser = XML::LibXML->new(); $xml_parser->input_callbacks($input_callbacks); warn "->parse_file:\n"; $xml_parser->parse_file('testcase.xml'); warn "->load_xml:\n"; $xml_parser->load_xml(location => 'testcase.xml');
Subject: testcase.xml
<?xml version="1.0" encoding="utf-8"?> <foo/>
Thanks for the report: - Fix the handling of XML::LibXML::InputCallbacks at load_xml(). - https://rt.cpan.org/Ticket/Display.html?id=58190 - The problem was that the input callbacks were not cloned in _clone(). This is fixed in the repository and will be uploaded to CPAN in the next release.