Bug#912780: Line numbers not printed on error despite XML_LIBXML_LINENUMBERS => 1
Wow that Carp::Always makes things much better. Do make a note about it on the man page or something, at the same time mentioning how it is different that other thing... Thanks.
Bug#912780: Line numbers not printed on error despite XML_LIBXML_LINENUMBERS => 1
On Mon, Jan 14, 2019 at 11:13:14PM +0800, 積丹尼 Dan Jacobson wrote: > > "NT" == Niko Tyni writes: > NT> On Sun, Nov 04, 2018 at 04:48:43AM +0800, 積丹尼 Dan Jacobson wrote: > >> Package: libxml-libxml-perl > >> Version: 2.0132+dfsg-2+b1 > >> Severity: minor > >> > >> Line numbers not printed on error despite XML_LIBXML_LINENUMBERS => 1: > >> $ cat e.pl > >> use XML::LibXML; > >> my $doc = XML::LibXML::Document->new( XML_LIBXML_LINENUMBERS => 1 ); > >> my $x = $doc->createElement('x'); > >> $x->appendChild($x); > >> $ perl -w e.pl > >> appendChild: HIERARCHY_REQUEST_ERR > > NT> Not sure what you expected to get, the offending line in the code > NT> perhaps? > > NT> It looks to me like this feature is about reporting line numbers > NT> in parsed XML documents, and you're not parsing anything. > > Well all I know is I want it to say something like > >> e.pl: 3: appendChild: HIERARCHY_REQUEST_ERR So you're indeed looking for code line numbers, not document line numbers. Again, the XML_LIBXML_LINENUMBERS feature is about the latter. Maybe try Carp::Always or something. % cat e.pl #!/usr/bin/perl -w use strict; use Carp::Always; use XML::LibXML; my $doc = XML::LibXML::Document->new( XML_LIBXML_LINENUMBERS => 1 ); my $x = $doc->createElement('x'); $x->appendChild($x); exit 0; % perl e.pl appendChild: HIERARCHY_REQUEST_ERR at e.pl line 8. Leaving this open as I don't see where XML_LIBXML_LINENUMBERS is documented. XML::LibXML::Parser is quite clear about the equivalent line_numbers() method though. If this option is activated, libxml2 will store the line number of each element node in the parsed document. The line number can be obtained using the "line_number()" method of the "XML::LibXML::Node" class (for non-element nodes this may report the line number of the containing element). The line numbers are also used for reporting positions of validation errors. -- Niko Tyni nt...@debian.org
Bug#912780: Line numbers not printed on error despite XML_LIBXML_LINENUMBERS => 1
> "NT" == Niko Tyni writes: NT> On Sun, Nov 04, 2018 at 04:48:43AM +0800, 積丹尼 Dan Jacobson wrote: >> Package: libxml-libxml-perl >> Version: 2.0132+dfsg-2+b1 >> Severity: minor >> >> Line numbers not printed on error despite XML_LIBXML_LINENUMBERS => 1: >> $ cat e.pl >> use XML::LibXML; >> my $doc = XML::LibXML::Document->new( XML_LIBXML_LINENUMBERS => 1 ); >> my $x = $doc->createElement('x'); >> $x->appendChild($x); >> $ perl -w e.pl >> appendChild: HIERARCHY_REQUEST_ERR NT> Not sure what you expected to get, the offending line in the code NT> perhaps? NT> It looks to me like this feature is about reporting line numbers NT> in parsed XML documents, and you're not parsing anything. Well all I know is I want it to say something like >> e.pl: 3: appendChild: HIERARCHY_REQUEST_ERR
Bug#912780: Line numbers not printed on error despite XML_LIBXML_LINENUMBERS => 1
On Sun, Nov 04, 2018 at 04:48:43AM +0800, 積丹尼 Dan Jacobson wrote: > Package: libxml-libxml-perl > Version: 2.0132+dfsg-2+b1 > Severity: minor > > Line numbers not printed on error despite XML_LIBXML_LINENUMBERS => 1: > $ cat e.pl > use XML::LibXML; > my $doc = XML::LibXML::Document->new( XML_LIBXML_LINENUMBERS => 1 ); > my $x = $doc->createElement('x'); > $x->appendChild($x); > $ perl -w e.pl > appendChild: HIERARCHY_REQUEST_ERR Not sure what you expected to get, the offending line in the code perhaps? It looks to me like this feature is about reporting line numbers in parsed XML documents, and you're not parsing anything. -- Niko Tyni nt...@debian.org
Bug#912780: Line numbers not printed on error despite XML_LIBXML_LINENUMBERS => 1
Package: libxml-libxml-perl Version: 2.0132+dfsg-2+b1 Severity: minor Line numbers not printed on error despite XML_LIBXML_LINENUMBERS => 1: $ cat e.pl use XML::LibXML; my $doc = XML::LibXML::Document->new( XML_LIBXML_LINENUMBERS => 1 ); my $x = $doc->createElement('x'); $x->appendChild($x); $ perl -w e.pl appendChild: HIERARCHY_REQUEST_ERR