MooseX...::Array(3pm)

๐Ÿ“ฆ
version 0.25 ยท 6 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

๐Ÿ’– MooseX::AttributeHelpers::MethodProvider::Array โ€” but make it a group chat ๐Ÿ’–

okay bestie, so this is a page from the User Contributed Perl Documentation, and the star of the show is MooseX::AttributeHelpers::MethodProvider::Array. yes that's a whole mouthful, we're gonna call it "the Array method provider" and move on with our lives ๐Ÿ’…


โœจ NAME โœจ

MooseX::AttributeHelpers::MethodProvider::Array โ€” it's the method generator for MooseX::AttributeHelpers::Collection::Array. that's literally its whole job and it does it beautifully, no cap ๐ŸŽ€


๐ŸŒธ VERSION ๐ŸŒธ

version 0.25 โ€” that's the one, that's the vibe check we're passing โœ…


๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

so this is a role, right? and what a role does is hand you all the method generators for MooseX::AttributeHelpers::Collection::Array. that's it. that's the tea. it generates methods, you use methods, everyone's happy ๐ŸŒˆ


๐Ÿ‘‘ METHODS ๐Ÿ‘‘

  • meta โ€” yes queen, the meta method is here, iconic as always

๐Ÿ“ PROVIDED METHODS ๐Ÿ“

lowkey the most important part. so listen โ€” this module also consumes the List method providers, and if you wanna peek at those provided methods you gotta go read that documentation. we're not repeating them here, go look, i believe in you ๐Ÿซถ

here's the lineup of methods it hands you:

  • get
  • pop
  • push
  • set
  • shift
  • unshift
  • clear
  • delete
  • insert
  • splice
  • sort_in_place
  • accessor

and now the two that need actual sentences, because they have โœจloreโœจ:

  • sort_in_place โ€” sorts the array in place, meaning it actually modifies the value of the attribute. not a copy. the real one. the main character ๐Ÿ’…

you can hand it an optional subroutine reference to sort with, exactly like you would with the core sort function. but โ€” and this is the plot twist โ€” instead of using $a and $b, you're gonna need to use $_[0] and $_[1] instead. write that down. tattoo it. whatever works bestie ๐Ÿ˜ญ

  • accessor โ€” this one's a two-for-one deal:
    • pass it one argument โ†’ it returns the value of the requested element
    • pass it two arguments โ†’ it sets the value of the requested element

one arg, you're reading. two args, you're writing. simple as ๐Ÿงš


๐Ÿซถ SUPPORT ๐Ÿซถ

got bugs? bestie, we've all got bugs. submit them through the RT bug tracker at <https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-AttributeHelpers> โ€” or if email is more your thing, bug-MooseX-AttributeHelpers@rt.cpan.org ๐Ÿ“ฎ

there's also a mailing list for users of this distribution, hanging out at <http://lists.perl.org/list/moose.html> ๐ŸŒธ

and if you wanna just talk about it, there's an irc channel for users of this distribution: #moose on irc.perl.org โ€” that's <irc://irc.perl.org/#moose> ๐Ÿ’ฌ come say hi, we don't bite


๐Ÿ’œ AUTHOR ๐Ÿ’œ

Stevan Little <stevan@iinteractive.com> โ€” the legend themselves ๐Ÿ‘‘


This software is copyright (c) 2007 by Stevan Little and Infinity Interactive, Inc. ๐Ÿ“

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. free as in go wild, just respect the terms bestie ๐Ÿ’–


and that's the whole page, fr fr ๐ŸŽ€ this was generated from the User Contributed Perl Documentation for MooseX...::Array(3pm), running on perl v5.34.0, dated 2022-06-15. slay, go write some attribute helpers, i'm obsessed with you ๐Ÿ’…โœจ

๐Ÿ“ฆ where this page comes from