HTML::...cessor(3pm)
β¨ NAME β¨
HTML::Widget::Accessor β Accessor Class π
so bestie, this is the page for HTML::Widget::Accessor(3pm), and yeah it lives in the User Contributed Perl Documentation corner of your man pages. let's go π¦
πΈ SYNOPSIS πΈ
use base 'HTML::Widget::Accessor';
that's it. that's the whole vibe. inherit and you're in π
π DESCRIPTION π
Accessor Class.
(iconic of it to say so little, honestly. it's giving mysterious. but fr fr, that's what it is: an accessor class. the methods below are where the actual business happens π)
π METHODS π
π attributes
π attrs
okay so these two are the same method, attrs is just the cute nickname. here's the full tea:
- Arguments:
%attributes - Arguments:
\%attributes - Return Value:
$self - Arguments: none
- Return Value:
\%attributes
so it Accepts either a list of key/value pairs, or a hash-ref. either one, dealer's choice:
$w->attributes( $key => $value );
$w->attributes( { $key => $value } );
and when you pass stuff in, it Returns the object reference, to allow method chaining. so you can just keep stacking calls, no cap π«Ά
β οΈ As of v1.10, passing a hash-ref no longer deletes current attributes, instead the attributes are added to the current attributes hash.
this part is important, so listen up bestie π This means the attributes hash-ref can no longer be emptied using $w->attributes( { } );. Instead, you may use %{ $w->attributes } = ();. (not me learning this the hard way, ngl)
and here's the little plot twist: As a special case, if no arguments are passed, the return value is a hash-ref of attributes instead of the object reference. why? This provides backwards compatibility to support:
$w->attributes->{key} = $value;
attrs is an alias for attributes. periodt. same method, shorter name, both slay β¨
π¦ mk_attr_accessors
- Arguments:
@names - Return Value:
@names
π AUTHOR π
Sebastian Riedel, sri@oook.de
π LICENSE π
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
okay that's the whole page, bestie!! you read all of it, main character energy fr fr π this was perl v5.36.0, dated 2023-08-10 β mwah, go forth and chain your methods π ππ¦
π¦ where this page comes from
- debian trixie: libhtml-widget-perl 1.11-7 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libhtml-widget-perl 1.11-7 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libhtml-widget-perl 1.11-7 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libhtml-widget-perl 1.11-7 Β· 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