XML::S...dMaker(3pm)
π NAME π
XML::SAX::EventMethodMaker β it's giving "SAX event names, creation of methods from templates". Bestie, that's literally the whole vibe.
β¨ VERSION β¨
version 0.46 β yes she's been around, she's a legacy icon π
π SYNOPSIS π
okay so here's the whole flex, verbatim:
use XML::SAX::EventMethodMaker qw(
sax_event_names missing_methods compile_methods
);
## Getting event names by handler type and SAX version
my @events = sax_event_names;
my @dtd_events = sax_event_names "DTDHandler";
my @sax1_events = sax_event_names 1;
my @sax1_dtd_events = sax_event_names 1, "DTDHandler";
## Figuring out what events a class or object does not provide
my @missing = missing_methods $class, @events ;
## Creating all SAX event methods
compile_methods $class, <<'TEMPLATE_END', sax_event_names;
sub <EVENT> {
my $self = shift;
... do something ...
## Pass the event up to the base class
$self->SUPER::<EVENT>( @_ );
}
TEMPLATE_END
## Creating some methods
compile_methods $class, <<'TEMPLATE_END', @method_names;
...
TEMPLATE_END
## Creating only missing event handlers
compile_missing_methods $class, <<'TEMPLATE_END';
...
TEMPLATE_END
π¦ DESCRIPTION π¦
So when you're building SAX machines, it's often handy to build a whole set of event handlers off one common template. This helper library (or class, she contains multitudes) provides the database of handler names, queryable by type, and
π and that's it. That's where the sentence ends. The original page just... stops there. We love a cliffhanger, no cap.
π NAME π
(yeah bestie, NAME shows up twice in this page. We don't make the rules, we just vibe with them.)
XML::SAX::EventMethodMaker β SAX event names, creation of methods from templates. Same icon, second entrance. π
π Functions π
- ### sax_event_names
my @names = sax_event_names @query_terms;
Takes a list of query terms and returns all matching events. Simple as that, fr fr.
Query terms may be:
- a SAX version number:
1or2(no floating point or ranges β do not try it) HandlerDTDHandlerContentHandlerDocumentHandlerDeclHandlerErrorHandlerEntityResolverLexicalHandler
In addition to normal SAX events, there are also "parse" events:
ParseMethods
Unrecognized query terms cause exceptions. So like, don't freestyle. π
If no query terms are provided, then all event names from all versions are returned except for parse methods (parse, parse_uri, ...).
If any version numbers are supplied, then only events from those version numbers are returned. No support for noninteger version numbers is provided, nor for ranges. So far, only two SAX versions exist in Perl, 1 and 2.
If any handler types are provided, then only events of those types are returned. Handler types are case insensitive. π
In other words, all returned events must match both a version number and a handler type.
No support for boolean logic is provided. Sorry bestie, no and/or/not shenanigans.
- ### missing_methods
my @missing = missing_methods __PACKAGE__, @event_names;
my @missing = missing_methods $object, @event_names;
This subroutine looks to see if the object or class has declared event handler methods for the named events. Any events that haven't been declared are returned. It's basically a vibe check on your class. π«Ά
It is sufficient to use subroutine prototypes to prevent shimming AUTOLOADed (or otherwise lazily compiled) methods:
sub start_document ;
- ### compile_methods
compile_methods __PACKAGE__, $template, @method_names;
compile_methods $object, $template, @method_names;
Compiles the given template for each given event name, substituting the event name for the string <EVENT> or <METHOD> in the template. There is no difference between these two tags, they are provided to only to let you make your templates more readable to you. Pick whichever one your brain likes, they're twins. π―
- ### compile_missing_methods
compile_missing_methods __PACKAGE__, $template, @method_names;
compile_missing_methods $objects, $template, @method_names;
Shorthand for calls like
compile_methods __PACKAGE__, $template,
missing_methods __PACKAGE__, @method_names;
πΈ Due Credit πΈ
The database of handlers by type was developed by Kip Hampton, modified by Robin Berjon, and pilfered and corrupted by me. Respect the lineage, bestie. π
π₯ LICENSE π₯
Database Copyright 2002, Barrie Slaymaker, Kip Hampton, Robin Berjon
Code Copyright 2002, Barrie Slaymaker <barries@slaysys.com>
You may use this under the terms of the Artistic, GNU Public, or BSD licences, as you see fit. Choose 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.
okay that's the whole page, you ate it, go build some SAX machines π
so like, this was the XML::S...dMaker(3pm) page from the User Contributed Perl Documentation, and it's tagged perl v5.34.0 dated 2022-06-28. bye bestie, drink water, call your mother, perldoc responsibly π¦π
π¦ 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