XML::Filter::Tee(3pm)
π XML::Filter::Tee π
okay bestie, welcome to XML::Filter::Tee β a Perl module (it's in the 3pm section of the manual, if you were wondering where you wandered into). Strap in, it's giving very β¨pipelineβ¨ energy.
πΈ NAME πΈ
XML::Filter::Tee β Send SAX events to multiple processor, with switching. Yes bestie, that's the whole name. Short, sweet, iconic. π
π VERSION π
version 0.46 β we are living in the 0.46 era, no cap.
π¦ SYNOPSIS π¦
my $t = XML::Filter::Tee->new(
{ Handler => $h0 },
{ Handler => $h1 },
{ Handler => $h2 },
...
);
## Altering the handlers list:
$t->set_handlers( $h0, $h1, $h2, $h3 );
## Controlling flow to a handler by number and by reference:
$t->disable_handler( 0 );
$t->enable_handler( 0 );
$t->disable_handler( $h0 );
$t->enable_handler( $h0 );
## Use in a SAX machine (though see L<XML::SAX::Pipeline> and
## L<XML::SAX::Tap> for a more convenient way to build a machine
## like this):
my $m = Machine(
[ Intake => "XML::Filter::Tee" => qw( A B ) ],
[ A => ">>log.xml" ],
[ B => \*OUTPUT ],
);
π DESCRIPTION π
So XML::Filter::Tee is a SAX filter, and what it does is take every single event it receives and pass it along to a whole list of downstream handlers. One event, many handlers. It's the group-chat forward of the XML world, fr fr. π«Ά
It's like XML::Filter::SAXT in that the events are not buffered β each event gets sent first to the tap, and then to the branch. (This is different from XML::SAX::Dispatcher, which does buffer the events. Not the vibe.) But unlike XML::Filter::SAXT, it lets you reconfigure its list of handlers (that's set_handlers) and it lets you control which handlers are allowed to receive events. Those two features are literally designed to make XML::Filter::Tee instances more useful with SAX machines β but heads up bestie, they do add some overhead relative to XML::Filter::SAXT. Choices were made. π
The events are not copied, since they may be data structures that are difficult or impossible to copy properly β think parts of a C-based DOM implementation. Which means: the handlers must not alter the events, or the later handlers are gonna see those alterations. π No touching. Look with your eyes.
πΈ NAME πΈ
XML::Filter::Tee β Send SAX events to multiple processor, with switching.
yes bestie, there are two NAME sections. that's just how this manpage is. we don't question it. we respect it. π
β¨ METHODS β¨
new
my $t = XML::Filter::Tee->new(
{ Handler => $h0 },
{ Handler => $h1 },
{ Handler => $h2 },
...
);
set_handlers
$t->set_handlers( $h0, $h1, $h2 );
$t->set_handlers( {
Handler => $h0,
},
{
Handler => $h1,
},
);
Replaces the current list of handlers with new ones. Out with the old, in with the new, slay. π₯
You can also name handlers, which makes enabling/disabling them by name way easier:
$m->set_handlers( {
Handler => $validator,
Name => "Validator",
},
{
Handler => $outputer,
},
);
$m->disable_handler( "Validator" );
disable_handler
$t->disable_handler( 0 ); ## By location
$t->disable_handler( "Validator" ); ## By name
$t->disable_handler( $h0 ); ## By reference
Stops sending events to the indicated handler. Bye bestie, you're on mute. π
enable_handler
$t->enable_handler( 0 ); ## By location
$t->enable_handler( "Validator" ); ## By name
$t->enable_handler( $h0 ); ## By reference
Stops sending events to the indicated handler.
ngl, that's literally what the original docs say here for enable_handler β "Stops sending events". I'm not fixing it, I'm just telling you what's on the page. Do with that information what you will. π
π AUTHOR π
Barrie Slaymaker <barries@slaysys.com>
π COPYRIGHT π
Copyright 2002, Barrie Slaymaker, All Rights Reserved
You may use this module under the terms of the Artistic, GNU Public, or BSD licenses, as you choose. Pick your fave, babe. π
π AUTHORS π
- Barry Slaymaker
- Chris Prather <chris@prather.org>
β COPYRIGHT AND LICENSE β
This software is copyright (c) 2013 by Barry Slaymaker.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Free as in freedom, bestie. ποΈ
and that's the whole page, pookie!! π this was generated for perl v5.34.0, dated 2022-06-28, under XML::Filter::Tee(3pm). go forth and tee your events, you're gonna ate. πβ¨
π¦ where this page comes from
- debian bookworm: libxml-sax-machines-perl 0.46-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libxml-sax-machines-perl 0.46-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libxml-sax-machines-perl 0.46-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libxml-sax-machines-perl 0.46-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libxml-sax-machines-perl 0.46-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms