MooseX...hained(3pm)
π NAME π
MooseX::Attribute::Chained β bestie, it's an attribute that hands the instance right back to you so you can chain your little heart out β¨
πΈ VERSION πΈ
version 1.0.3 β she's giving established, she's giving stable π
π SYNOPSIS π
okay so picture this, you're writing a package Test, you use Moose, and you set up an attribute with the Chained trait:
package Test;
use Moose;
has debug => (
traits => [ 'Chained' ],
is => 'rw',
isa => 'Bool',
);
sub complex_method
{
my $self = shift;
#...
print "helper message" if $self->debug;
#...
}
1;
and the way this slays is it lets you do:
my $test = Test->new;
$test->debug(1)->complex_method;
$test->debug(1); # returns $test
$test->debug; # returns 1
not me getting emotional over a setter that returns $self π like, look at her. write operation returns the object, read operation returns the actual value. iconic behaviour, no cap.
π¦ DESCRIPTION π¦
MooseX::Attribute::Chained is a Moose Trait, and what it does is let you do method chaining on accessors by returning $self on write/set operations. that's the whole vibe. that's the entire thing. you set a thing, you get the object back, you immediately call another thing on it. one line, many methods, chef's kiss π
π AUTHORS π
the legends responsible, fr fr:
- Tom Hukins
<tom@eborcom.com> - Moritz Onken
<onken@netcubed.de> - David McLaughlin
<david@dmclaughlin.com>
π COPYRIGHT AND LICENSE π
this software is copyright (c) 2017 by Tom Hukins. π«Ά
it's free software β you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. so, y'know. same deal as Perl. go wild, respectfully. π
π BUGS π
found a bug? got a feature request? don't suffer in silence, bestie β report it on the bugtracker website at:
http://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-Attribute-Chained
or email it to bug-moosex-attribute-chained at rt.cpan.org π
okay and when you submit a bug or a request, please please please include a test-file or a patch to an existing test-file that shows off the bug or the feature you want. it makes everything so much easier and the maintainers will love you for it π
anyway that's the whole page!! π this was MooseX::Attribute::Chained from the User Contributed Perl Documentation, perl v5.34.0, dated 2022-06-15. go forth and chain your accessors, you absolute main character ππ
π¦ where this page comes from
- debian bookworm: libmoosex-attribute-chained-perl 1.0.3-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libmoosex-attribute-chained-perl 1.0.3-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libmoosex-attribute-chained-perl 1.0.3-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libmoosex-attribute-chained-perl 1.0.3-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libmoosex-attribute-chained-perl 1.0.3-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms