Parser:...::Stream(3)
π NAME π
okay so this page is Parser:...::Stream(3) from the User Contributed Perl Documentation, and the module is XML::Parser::Style::Stream β Stream style for XML::Parser. slay, that's the whole name vibe. β¨
π¦ SYNOPSIS π¦
bestie, here's the starter pack, exactly as it goes:
use XML::Parser;
my $p = XML::Parser->new(Style => 'Stream', Pkg => 'MySubs');
$p->parsefile('foo.xml');
{
package MySubs;
sub StartTag {
my ($e, $name) = @_;
# do something with start tags
}
sub EndTag {
my ($e, $name) = @_;
# do something with end tags
}
sub Characters {
my ($e, $data) = @_;
# do something with text nodes
}
}
β¨ DESCRIPTION β¨
This style uses the Pkg option to find subs in a given package to call for each event. periodt. And no cap: if none of the subs that this style looks for is there, then the effect of parsing with this style is to print a canonical copy of the document without comments or declarations. π€―
Vibe check: all the subs receive the Expat instance for the document they're parsing as their 1st parameter. main character energy, honestly. π
It looks for the following routines:
StartDocumentβ called at the start of the parse. π¬StartTagβ called for every start tag, with a second parameter of the element type. The$_variable will contain a copy of the tag, and the%_variable will contain attribute values supplied for that element. πEndTagβ called for every end tag, with a second parameter of the element type. The$_variable will contain a copy of the end tag. πTextβ called just before start or end tags, with accumulated non-markup text in the$_variable. πPIβ called for processing instructions. The$_variable will contain a copy of the PI, and the target and data are sent as 2nd and 3rd parameters respectively. π§EndDocumentβ called at conclusion of the parse. π
mwah π that's the whole page! This one is from perl v5.42.0, dated 2026-03-20, and the page name is Parser:...::Stream(3). πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-XML-Parser 2.470.0-160000.3.1 Β· Artistic-2.0
- opensuse-leap 16.0: perl-XML-Parser 2.470.0-160000.3.1 Β· Artistic-2.0
- opensuse-leap 16.0: perl-XML-Parser 2.470.0-160000.3.1 Β· Artistic-2.0
- opensuse-leap 16.0: perl-XML-Parser 2.470.0-160000.3.1 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms