STAG-HANDLE(1)
π STAG-HANDLE(1) π
okay bestie, welcome to the stag-handle manual page β it's a User Contributed Perl doc, and it's lowkey iconic. sit down, grab a strawberry π, and let's get into it.
β¨ NAME β¨
stag-handle β streams a stag file through a handler into a writer. that's the whole vibe. it's giving "glow up your data on the way out the door" π
π¦ SYNOPSIS π¦
stag-handle -w itext -c my-handler.pl myfile.xml > processed.itext
stag-handle -w itext -p My::Parser -m My::Handler myfile.xml > processed.itext
no cap, that's it. that's the whole thing. two lines and she's serving β¨
πΈ DESCRIPTION πΈ
so basically, stag-handle takes a Stag compatible format β that's xml, sxpr or itext, pick your fighter β turns the data into an event stream, and then passes that stream through my-handler.pl. the way that it just... transforms things on the fly? obsessed. π
here's every single option, fr fr, and we are NOT skipping any of them:
-help,hβ shows this document. hi. you're reading it. you found it. slay. π-module,-m PERLMODULEβ a module that gets used to transform the input events. that module should inherit fromData::Stag::BaseHandler. periodt.-unit,-u NODE_NAMEβ you should always use this option if you specify-m, bestie, i'm not kidding. this is the unit that gets passed to the handler/transformer. it will get set automatically if you use the-c,-sor-toptions instead. and yes, you can set multiple units:
-u foo -u bar -u boz
-writer,-w WRITERβ the writer for the final transformed tree. can bexml,sxproritext. choose wisely, main character. π-module,-m MODULEβ perl modules for handling events. (yes, it's listed again. the manpage said it twice. i said it twice. we're both committed to the bit. π)-codefile,-c FILEβ a file containing a perl hashref containing event handlers β peep the example below for the tea β-sub,-s PERLβ a perl hashref containing handlers, inline, right there, in your command. spicy. π₯-trap,-t ELEMENT=SUBβ ...and that's literally all the manpage says about it. no further explanation. it's giving mystery, it's giving enigma, it's giving iykyk π
π§ EXAMPLES π§
here's a whole little my-handler.pl to gag over:
unix> cat my-handler.pl
{
person => sub {
my ($self, $person) = @_;
$person->set_fullname($person->get_firstname . ' ' .
$person->get_lastname);
$person;
},
address => sub {
my ($self, $address) = @_;
# remove addresses altogether from processed file
return;
},
}
see what she's doing? person gets a fullname built from firstname + a space + lastname (glow up β¨), and address just gets straight up deleted from the processed file because the handler returns nothing. the audacity. the power. π
π POD ERRORS π
okay so. the document itself had some coding errors. here's the receipts, explained below:
around line 138:
=over should be: '=over' or '=over positive_number'
not me exposing the manpage's own typos. everybody has a rough day, we still love her. π«Ά
heads up bestie: keep every flag, every default and every-m/-upairing exactly as written up there β the vibe is mine but the facts are hers, and the facts do not change. no cap. π¦
that's the whole page!! π written by the perl docs girlies, perl v5.42.0, dated 2025-07-25, and STAG-HANDLE(1) forever and always. mwah. πβ¨
π¦ where this page comes from
- fedora 43: perl-Data-Stag 0.14-28.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms