Parser:...le::Subs(3)

🌸 NAME 🌸

XML::Parser::Style::Subs β€” bestie, it is literally the glue 🫢 for handling element callbacks. Welcome to the User Contributed Perl Documentation page for it (yes, the one hanging out as Parser:...le::Subs(3), iykyk).

✨ SYNOPSIS ✨

use XML::Parser;
my $p = XML::Parser->new(Style => 'Subs', Pkg => 'MySubs');
$p->parsefile('foo.xml');

{
  package MySubs;

  sub foo {
    # start of foo tag
  }

  sub foo_ {
    # end of foo tag
  }
}

πŸ’… DESCRIPTION πŸ’…

Okay so here's the tea β˜•: every time an element starts, a sub with that element's name gets called β€” and it's a sub inside the package you specified with the Pkg option. It gets the exact same parameters that the Start handler gets called with. Slay. πŸ’–

Every time an element ends, a sub with that same name plus an underscore ("_") appended gets called. It gets the exact same parameters that the End handler gets called with. No cap. ✨

And parse? It literally returns nothing special. That's it. Iconic. πŸ’…

Vibe check: in the example, foo is the start-of-foo callback and foo_ is the end-of-foo callback β€” the underscore is the whole lil' signal πŸ¦‹

mwah πŸ’‹ β€” footer vibes: perl v5.42.0, dated 2026-03-20. From the User Contributed Perl Documentation girlies. periodt πŸŽ€