MooseX...::With(3pm)

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

πŸ’– MooseX::Declare::Syntax::Keyword::With β€” the vibe check πŸ’–

okay bestie, so this is a page from the User Contributed Perl Documentation for MooseX::Declare::Syntax::Keyword::With, and it's literally about applying roles inside a class- or role-body. it's giving "small module, big personality", and you're gonna eat it up. πŸŽ€


✨ NAME ✨

MooseX::Declare::Syntax::Keyword::With β€” apply roles within a class- or role-body. no cap, that's the whole job description. πŸ‘‘


🌸 VERSION 🌸

version 0.43 β€” that's the one, that's the number, don't @ me.


πŸ¦‹ SYNOPSIS πŸ¦‹

look at this iconic little snippet:

use MooseX::Declare;

class ::Baz {
    with 'Qux';
    ...
}

that's it. that's the whole thing. the with is doing the heavy lifting and it's serving. πŸ’…


πŸ’œ DESCRIPTION πŸ’œ

so the with keyword lets you apply roles to the local class or role. it's not like the with-option on the class and role keywords β€” and the difference is lowkey the whole point: this one applies the roles immediately, instead of deferring application until the end of the class- or role-definition. instant gratification, main character energy, periodt. ⭐

it also differs slightly from the with that Moose itself provides, because this one expands relative role names (like ::Foo) according to the current namespace. so if your role name is feeling shy and only gave you the short version, this keyword will fill in the rest. 🧚


πŸ’… METHODS πŸ’…

πŸ”₯ parse πŸ”₯

Object->parse(Object $context)

what it does: it will skip the declarator, and then make the with invocation apply the set of specified roles β€” but only after any possible namespace-expanding has happened. so: expand first, apply second, slay always. ✨


🫢 CONSUMES 🫢

  • MooseX::Declare::Syntax::KeywordHandling

yeah it eats that one. it's a whole meal. πŸ“


🌈 SEE ALSO 🌈

  • MooseX::Declare
  • MooseX::Declare::Syntax::Keyword::Namespace

go read those too, bestie, they're part of the lore. iykyk. πŸ’–


πŸ‘‘ AUTHOR πŸ‘‘

Florian Ragwitz <rafl@debian.org>

the legend himself. we stan. πŸŽ€


This software is copyright (c) 2008 by Florian Ragwitz.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

(translation: it's free, go wild, just keep the same terms as Perl 5 itself. legal stuff, but make it cute. πŸ¦‹)


and that's the whole page, no notes. the docs were generated by perl v5.34.0 on 2022-06-15, so shoutout to that version and that date for bringing us this absolute gem. bye bestie, go apply some roles immediately πŸ’–βœ¨πŸŒΈ
πŸ“¦ where this page comes from