HTML::...cessor(3pm)

πŸ“¦
version 1.11 Β· 3 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ 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