MooseX...ribute(3pm)

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

✨ NAME ✨

MooseX::AttributeShortcuts::Trait::Attribute β€” the Shortcuts attribute trait, but like, the actual one bestie πŸ’…


πŸŽ€ VERSION πŸŽ€

This doc is describing version 0.037 of MooseX::AttributeShortcuts::Trait::Attribute β€” which dropped on November 20, 2017 as part of MooseX-AttributeShortcuts. Iconic release date, no cap. ✨


🌸 DESCRIPTION 🌸

Okay so this right here? This is the real attribute trait that does all the heavy lifting behind MooseX::AttributeShortcuts. If you wanna know about any of the shiny new attribute options, go read that package's docs instead β€” because this page is mainly here to document the extra attributes, methods, and role parameters that this role brings to the party. 🫢

And listen β€” every method we hook in that chains off Moose's _process_options() gets the _mxas_ prefix, and generally those aren't documented in the POD at all. But any internal methods of Moose::Meta::Attribute that we wrap or otherwise override? Yeah, those we do document here too. Bestie behavior fr fr. πŸ’–


πŸ‘‘ ROLE PARAMETERS πŸ‘‘

Parameterized roles accept parameters that influence their construction β€” like little settings you hand over at build time, and they shape how the thing gets made. This role accepts the following ones:

writer_prefix

builder_prefix

(yes those are just the two names, sitting there, being parameters 🌈)


πŸ¦‹ ATTRIBUTES πŸ¦‹

constraint

A CodeRef, and it's read-only. So like… look, don't touch. πŸ‘‘

original_isa

(that's it, that's the whole entry β€” she's mysterious, she's an attribute, we move on πŸ’€)

trigger_method

Holds the name of the method that's gonna get invoked as a trigger. Slay.


πŸ”₯ BEFORE METHOD MODIFIERS πŸ”₯

_process_options

So here's the tea: we wrap _process_options() instead of the newer _process_is_option(), because honestly that makes our life way easier from a Moose 1.x/2.x compatibility standpoint β€” and also because we're generally messing with more than just the 'is' option at one time anyway. Multitasking queen. πŸ’…


🌈 AROUND METHOD MODIFIERS 🌈

_make_delegation_method

Right here is where we create and install any custom accessors that have been defined. Boom. ✨


⭐ AFTER METHOD MODIFIERS ⭐

attach_to_class

We hijack attach_to_class so we can install our anon_builder, if we have one. And just so you know β€” we do not go the normal associate_method/install_accessor/etc route, because this is kinda… different. (Translation: the builder is not an accessor of this attribute, and it should not be installed as one. Don't do it. 🚫)


πŸ’œ METHODS πŸ’œ

has_constraint

Predicate for the "constraint" attribute. πŸŽ€

has_original_isa

Predicate for the "original_isa" attribute. πŸŽ€

has_trigger_method

Predicate for the "trigger_method" attribute. πŸŽ€

builder_method_metaclass()

Returns the metaclass we're gonna use to install a inline builder. 😭 (yes, "a inline", we said what we said)

canonical_writer_prefix

Returns the writer prefix; this is almost always "set_". Periodt.

canonical_builder_prefix

Returns the builder prefix; this is almost always "_build_". Also periodt.


πŸ“ PREFIXES πŸ“

We accept two parameters when you use this module β€” and they impact how builders and writers get named. Naming rights, basically. 🧚

-writer_prefix

use MooseX::::AttributeShortcuts -writer_prefix => 'prefix';

The default writer prefix is "_set_". If you'd prefer it to be something else (say, "_"), this is exactly where you'd do that. Go off. πŸ’–

-builder_prefix

use MooseX::AttributeShortcuts -builder_prefix => 'prefix';

The default builder prefix is "_build_" β€” because that's what "lazy_build" in Moose does, and because that's what people in general recognize as build methods. It's giving tradition. ✨


🌸 SEE ALSO 🌸

Please go peek at these modules/websites for more info related to this module:

  • MooseX::AttributeShortcuts

πŸ’€ BUGS πŸ’€

Please report any bugs or feature requests on the bugtracker website <https://github.com/RsrchBoy/moosex-attributeshortcuts/issues> 🫢

When you're submitting a bug or a request, please include a test-file β€” or a patch to an existing test-file β€” that illustrates the bug or the desired feature. Like, actually show us, bestie. That's the whole vibe check. πŸ™ˆ

✨ AUTHOR ✨

Chris Weyl <cweyl@alumni.drew.edu> πŸ‘‘


This software is Copyright (c) 2017, 2015, 2014, 2013, 2012, 2011 by Chris Weyl.

This is free software, licensed under:

The GNU Lesser General Public License, Version 2.1, February 1999

and that's the whole page, bestie!! this was MooseX...ribute(3pm) from the User Contributed Perl Documentation, running on perl v5.34.0, dated 2022-06-15. stay slay, stay documented, mwah πŸ’…πŸ’–βœ¨