XML::Li...neNumber(3)
π XML::LibXML::Devel::SetLineNumber π
okay bestie, welcome to the little corner of CPAN where we set line numbers on an XML::LibXML::Node. yes, really. no cap. the manual name is XML::LibXML::Devel::SetLineNumber and it lives in the User Contributed Perl Documentation section, and we are so normal about it. β¨
πΈ NAME πΈ
XML::LibXML::Devel::SetLineNumber β set the line number for an XML::LibXML::Node π
π¦ SYNOPSIS π¦
like, here's the whole vibe in one go:
use XML::LibXML::Devel::SetLineNumber;
my $node = $document->getElementsByTagName('foo')->get_node(1);
set_line_number($node, 8);
say $node->line_number; # says "8"
look at that. you hand it a node and a number and boom, the node is lying about where it came from. iconic behaviour honestly. π
π DESCRIPTION π
so this module exports exactly one function. one. a single little guy:
set_line_number($node, $number)β sets a node's line number. that's it. that's the function. no plot twist. π«Ά
now. why in the name of all that is good and holy would you want to do that? π
frankly? you probably don't. and you probably shouldn't. i'm not even joking.
there's just about one situation where it makes sense (yes, the original says "sitution", we're keeping the energy, the typo stays in spirit π). if you are, say, writing a parser for a non-XML format that happens to have an XML-like data model, then you might wish to parse your format into an XML::LibXML document with elements, attributes and so on. and you might want all those nodes to return the correct line numbers when the line_number method is called on them. say, for instance, that you're working on HTML::HTML5::Parser. π
so like. one extremely specific use case. that's the whole market. π
π THIS MODULE IS WELL DODGY π
and you're a fool if you use it. those are the vibes. that's the section title. we are not softening it. π€
if you do feel you really must use this module (and bestie, do we need to talk?), it's probably best to load it like this:
eval {
require XML::LibXML::Devel::SetLineNumber;
import XML::LibXML::Devel::SetLineNumber;
1;
} or *set_line_number = sub { 1 };
instead of the normal use XML::LibXML::Devel::SetLineNumber.
basically it's giving "if this module isn't there, whatever, we'll just define a fake set_line_number that returns 1 and move on with our lives". graceful degradation but make it dramatic. π§
β οΈ real talk: this is a development module. the docs literally call it dodgy. treat it accordingly. no notes.
π SEE ALSO π
XML::LibXMLXML::LibXML::DevelXML::LibXML::Node
(the holy trinity of "the thing you're actually using" + "the dev-side stuff" + "the node you're messing with"). go read them, iykyk. π
π AUTHOR π
Toby Inkster <tobyink@cpan.org>. thank you for your service king π«‘π
π COPYRIGHT AND LICENCE π
Copyright (C) 2012 by Toby Inkster
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
same terms as Perl itself, periodt. π
π DISCLAIMER OF WARRANTIES π
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
π the all-caps is not me being extra, that's the actual warranty disclaimer and it is loud on purpose. no promises, no takebacks, no vibes-based refunds.
and that's the whole page bestie!! this was XML::LibXML::Devel::SetLineNumber from perl v5.42.0, dated 2025-07-25 β go forth, set a line number, feel slightly unwell about it. mwah πβ¨π¦
π¦ where this page comes from
- fedora 43: perl-XML-LibXML-Devel-SetLineNumber 0.002-31.fc43 Β· (GPL-1.0-or-later OR Artistic-1.0-Perl) AND ((GPL-1.0-or-later OR Artistic-1.0-Perl) OR LicenseRef-Callaway-CC-BY-SA) AND LicenseRef-Callaway-Public-Domain
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms