XML::S...peline(3pm)
π NAME π
XML::SAX::Pipeline β Manage a linear pipeline of SAX processors
okay so this is the page for XML::SAX::Pipeline, straight out of the User Contributed Perl Documentation corner of the world. Say hi to your new bestie for gluing SAX processors together in a little line π
β¨ VERSION β¨
version 0.46 β she's been around a minute and she's still iconic π«Ά
πΈ SYNOPSIS πΈ
use XML::SAX::Machines qw( Pipeline ); ## Most common way
use XML::Fitler::Foo;
my $m = Pipeline(
XML::Filter::Foo->new, ## Create it manually
"XML::Filter::Bar", ## Or let Pipeline load & create it
"XML::Filter::Baz",
{
## Normal options
Handler => $h,
}
);
## To choose the default parser automatically if XML::Filter::Foo
## does not implement a parse_file method, just pretend the Pipeline
## is a parser:
$m->parse_file( "blah" );
## To feed the pipeline from an upstream processor, treat it like
## any other SAX filter:
my $p = Some::SAX::Generator->new( Handler => $m );
## To read a file or the output from a subprocess:
my $m = Pipeline( "<infile.txt" );
my $m = Pipeline( "spew_xml |" );
## To send output to a file handle, file, or process:
my $m = Pipeline( ..., \*STDOUT );
my $m = Pipeline( ..., ">outfile.txt" );
my $m = Pipeline( ..., "| xmllint --format -" );
literally every way you'd ever wanna wire one up, all in one place. obsessed π
π¦ DESCRIPTION π¦
So an XML::SAX::Pipeline is a linear sequence of SAX processors. Events get handed to the "Intake" end of the pipeline, and the last filter in the line β the one that's actually processing events β pushes them out the "Exhaust" end, straight to whatever filter is set as the pipeline's handler. it's giving assembly line but make it XML β¨
+-----------------------------------------------------------+
| An XML:SAX::Pipeline |
| Intake |
| +---------+ +---------+ +---------+ Exhaust |
--+-->| Stage_0 |--->| Stage_1 |-->...-->| Stage_N |----------+----->
| +---------+ +---------+ +---------+ |
+-----------------------------------------------------------+
Same energy as all SAX machines, bestie: a pipeline can also spin up an ad hoc parser (it uses XML::SAX::ParserFactory) if you ask it to parse something and the very first SAX processer in the pipeline can't handle a parse request π
+-------------------------------------------------------+
| An XML:SAX::Pipeline |
| Intake |
| +--------+ +---------+ +---------+ Exhaust |
| | Parser |-->| Stage_0 |-->...-->| Stage_N |----------+----->
| +--------+ +---------+ +---------+ |
+-------------------------------------------------------+
β¦or if you just hand it an input file like this:
my $m = Pipeline(qw(
<input_file.xml
XML::Filter::Bar
XML::Filter::Baz
));
Pipelines (and machines, hi) can also make ad hoc XML::SAX::Writer instances when you specify an output file handle (peep the SYNOPSIS, it's right there) or an output file:
my $m = Pipeline(qw(
XML::Filter::Bar
XML::Filter::Baz
>output_file.xml
));
And thanks to Perl's magic open (go read perlopentut, it's a whole vibe), you can read and write from processes:
my $m = Pipeline(
"gen_xml.pl |",
"XML::Filter::Bar",
"XML::Filter::Baz",
"| consume_xml.pl",
);
This plays so nicely with an XML::SAX::Tap if you wanna drop a handy lil debugging tap into a pipeline (or any other machine, she's not picky):
my $m = Pipeline(
"<input_file.xml"
"XML::Filter::Bar",
Tap( "| xmllint --format -" ),
"XML::Filter::Baz",
">output_file.xml",
);
π NAME π
XML::SAX::Pipeline β Manage a linear pipeline of SAX processors
(yes bestie, she said it again. the original said it twice, so we said it twice. no notes π)
π METHODS π
Most of the methods live over in XML::SAX::Machine, so go say hey to that page for the full menu. Here's the one that's actually here:
β¨ new β¨
my $pipeline = XML::SAX::Pipeline->new( @processors, \%options );
Creates a pipeline and links all of the given processors together. This is the longhand version of Pipeline(). Same thing, just written out all proper-like π
π 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 β your choice, pick your fighter π«Ά
π 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.
and that's the whole page, bestie π she ships asperl v5.34.0, dated2022-06-28, and she lives under the nameXML::S...peline(3pm)β go forth and pipeline, mwah πβ¨
π¦ 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