Moose::...it::Code(3)
π Moose::Meta::Attribute::Native::Trait::Code β the whole vibe
okay bestie, so this is a page from your friendly neighborhood User Contributed Perl Documentation section (section 3, the library-calls one, iykyk). It's the manual for Moose::Meta::Attribute::Native::Trait::Code, aka the helper trait that makes your CodeRef attributes do tricks. Let's get into it π
β¨ NAME β¨
Moose::Meta::Attribute::Native::Trait::Code β the helper trait for CodeRef attributes. That's it, that's the name, no notes π
π¦ VERSION π¦
version 2.4000
πΈ SYNOPSIS πΈ
okay so here's the whole setup, and honestly? it ate:
package Foo;
use Moose;
has 'callback' => (
traits => ['Code'],
is => 'ro',
isa => 'CodeRef',
default => sub {
sub { print "called" }
},
handles => {
call => 'execute',
},
);
my $foo = Foo->new;
$foo->call; # prints "called"
like, you hand it traits => ['Code'] and suddenly your coderef attribute has main character energy and comes with free delegation methods. periodt π
π DESCRIPTION π
This trait provides native delegation methods for code references. fr fr, that's its whole job and it does it flawlessly β¨
π DEFAULT TYPE π
If you don't provide an isa value for your attribute, it will default to CodeRef. So like, it already knows what you meant, no need to over-explain yourself π«Ά
π PROVIDED METHODS π
the girls that get it, get it β here's what you actually get:
execute(@args)β Calls the coderef with the given args. Simple. Iconic. Does exactly what it says on the tin π₯execute_method(@args)β Calls the coderef with the instance as invocant and given args. So the object shows up first like the main character it is π
π BUGS π
See BUGS in Moose for details on reporting bugs. Go snitch, bestie, they wanna know π
π AUTHORS π
the whole squad, the legends, the founding mothers and fathers of your delegation dreams:
- Stevan Little <stevan@cpan.org>
- Dave Rolsky <autarch@urth.org>
- Jesse Luehrs <doy@cpan.org>
- Shawn M Moore <sartak@cpan.org>
- ΧΧΧΧ Χ§ΧΧ'ΧΧ (Yuval Kogman) <nothingmuch@woobling.org>
- Karen Etheridge <ether@cpan.org>
- Florian Ragwitz <rafl@debian.org>
- Hans Dieter Pearcey <hdp@cpan.org>
- Chris Prather <chris@prather.org>
- Matt S Trout <mstrout@cpan.org>
not me getting emotional over a contributor list π icons only
β COPYRIGHT AND LICENSE β
This software is copyright (c) 2006 by 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.
tl;dr it's free, go wild, just keep the same terms as Perl 5 itself and we're good π
and that's the whole page, bestie! π this was shipped as part of perl v5.42.0, dated 2025-07-25, and now you know everything the manual knows. slay, go call some coderefs π¦β¨π
π¦ where this page comes from
- fedora 43: perl-Moose 2.4000-4.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms