Weasel...ndlers(3pm)
π Weasel::WidgetHandlers β the whole vibe π
okay so bestie, the page header thing says Weasel...ndlers(3pm) (yes it's truncated, that's just how man pages do, don't @ me) and it lives in the User Contributed Perl Documentation section. Version is 0.32. Let's get into it. π¦
β¨ NAME β¨
Weasel::WidgetHandlers β the part that maps elements to widget handlers, i.e. the matchmaker of your DOM π
πΈ VERSION πΈ
version 0.32
π SYNOPSIS π
use Weasel::WidgetHandlers qw( register_widget_handler );
register_widget_handler(
'Weasel::Widgets::HTML::Radio', # Perl class handler
'HTML', # Widget group
tag_name => 'input',
attributes => {
type => 'radio',
});
register_widget_handler(
'Weasel::Widgets::Dojo::FilteringSelect',
'Dojo',
tag_name => 'span',
classes => ['dijitFilteringSelect'],
attributes => {
role => 'presentation',
...
});
like, that's the whole point. you tell it a class, a group, and what the element looks like. it does the rest. slay. β¨
π¦ DESCRIPTION π¦
So here's the tea: widget handlers map HTML elements to Perl class instances, and they decide based on the HTML tag and its attributes. That Perl class is then your little encapsulation station β it wraps up all the interaction with the HTML element and its children, so instead of doing raw HTML DOM stuff you're doing functional behaviours. it's giving abstraction, and honestly? iconic. π
A widget can also be composed of one or more child-widgets, no cap. Like, a form could be made of several input fields and a button, and all of those get mapped to widgets that handle the interactions for their specific element type. nesting is the moment. π
You can develop classes and register handlers for widgets that do the same behaviours as basic HTML widgets β think the select tag for example. Like, a Dojo Toolkit, Vue or React widget could be mapped to specific classes that encapsulate the DOM interactions required to make those widgets transparent to the Perl code that's interacting with them. literally invisible, main character energy but for the Perl side. An example of a widget mimicing to be a select tag is Weasel::Widgets::Dojo::Select. π
π DEPENDENCIES π
(this section is empty in the original, bestie. nothing to see here. moving on. π)
β SUBROUTINES/METHODS β
register_widget_handler($handler_class_name, $group_name, %conditions)β Registers$handler_class_nameto be the instantiated widget returned for an element matching%conditionsinto$group_name.
And listen: Weasel::Session can select a subset of widgets to be applicable to that session by adding a subset of available groups to that session. so you get to pick your faves. π
best_match_handler_class($driver, $_id, $groups)β Returns the best matching handler's class name, within the groups listed in the arrayref$groups, orundefin case of no match.
When $groups is undef, all registered handlers will be searched. πΈ
When multiple handlers are considered "best match", the one last added to the group last mentioned in $groups is selected. yes it's giving favouritism and yes that's on purpose. π
π AUTHOR π
Erik Huelsmann
π«Ά CONTRIBUTORS π«Ά
Erik Huelsmann Yves Lavoie
π MAINTAINERS π
Erik Huelsmann
π BUGS AND LIMITATIONS π
Bugs can be filed in the GitHub issue tracker for the Weasel project:
https://github.com/perl-weasel/weasel/issues
fr fr if something's cursed, tell the tracker, don't suffer in silence bestie π
π₯ SOURCE π₯
The source code repository for Weasel is at
https://github.com/perl-weasel/weasel
π§ SUPPORT π§
Community support is available through perl-weasel@googlegroups.com <mailto:perl-weasel@googlegroups.com>.
πΈ LICENSE AND COPYRIGHT πΈ
(C) 2016-2023 Erik Huelsmann
Licensed under the same terms as Perl.
and that's the whole page, bestie!! this one was generated by perl v5.40.1 on 2025-05-24, and the footer was screaming Weasel...ndlers(3pm) at us the whole time. go forth and map your widgets. periodt. πβ¨ππ¦π
π¦ where this page comes from
- debian trixie: libweasel-perl 0.32-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libweasel-perl 0.32-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libweasel-perl 0.32-1 Β· 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