MooseX...cessor(3pm)

πŸ“¦
version 0.10 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’… NAME πŸ’…

MooseX::SemiAffordanceAccessor β€” bestie, it's literally here to name your accessors foo() and set_foo(). That's the whole gig. πŸ‘‘


✨ VERSION ✨

version 0.10 β€” yes she's serving vintage, and yes she still slays.


πŸ¦‹ SYNOPSIS πŸ¦‹

use Moose;
use MooseX::SemiAffordanceAccessor;

# make some attributes

That's it. That's the vibe. Go make some attributes, queen. πŸŽ€


🌸 DESCRIPTION 🌸

okay so here's the tea πŸ“ β€” this module is not out here handing you a bunch of methods. Nope. The only thing it does is vibe-check the default naming policy of whatever class loaded it, and switch things up so your accessors get split into a get method and a set method. No cap.

  • The get methods keep the same name as the accessor. Iconic. ✨
  • The set methods get prefixed with set_. Periodt. πŸ’…

And if you define an attribute with a leading underscore? Then the set method is gonna start with _set_ instead. She matches your energy. 🧚

Now β€” if you explicitly set a reader or writer name when you're creating an attribute, then that attribute's naming scheme is left unchanged. She doesn't touch what you already named yourself, that would be rude. πŸ™ˆ

Fun fact that's lowkey highkey cute: the name "semi-affordance" comes from David Wheeler's Class::Meta module. πŸŽ€


πŸ‘‘ ACCESSORS IN ROLES πŸ‘‘

Okay this part is a whole saga, so sit down bestie. 🫢

Back prior to version 1.9900 of Moose, attributes that got added to a class ended up with that class's attribute traits. So like… if your class used MooseX::SemiAffordanceAccessor, then any attributes provided by roles you consumed would end up with the semi-affordance style of accessor too. They got dragged along for the ride. 😭

As of Moose 1.9900, that is no longer the case. Attributes provided by roles no longer acquire the consuming class's attribute traits. The era of accidental drip-transfer is over. πŸ’€

BUT. 🫒 With Moose 1.9900+, you can now use MooseX::SemiAffordanceAccessor directly in roles. And any attributes defined by that role will have semi-affordance style accessors, regardless of what attribute traits the consuming class has. That's the glow-up. That's main character energy. 🌈⭐


πŸ› BUGS πŸ›

Found a bug? Got a feature request? Don't suffer in silence, bestie. 😭 Report it to bug-moosex-semiaffordanceaccessor@rt.cpan.org, or slide through the web interface at <http://rt.cpan.org>.

The author will be notified, and then you'll automatically be notified of progress on your bug as changes get made. So like, you will get updates. No ghosting. 🫢

πŸŽ€ AUTHOR πŸŽ€

Dave Rolsky <autarch@urth.org> β€” we stan. πŸ‘‘


This software is Copyright (c) 2011 by Dave Rolsky.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)

Free software, GPL compatible, iconic behaviour fr fr. ✨


and that's the whole page, bestie β€” this was MooseX...cessor(3pm) from the User Contributed Perl Documentation, built on perl v5.34.0 and dated 2022-06-15. go forth and name your accessors beautifully πŸ’…πŸŒΈπŸ¦‹