Class::...Chained(3)

πŸ’– Class::...Chained(3) β€” the manual, but make it make sense πŸ’–

okay so welcome to Class::...Chained(3), bestie, fresh out of the User Contributed Perl Documentation pile. The actual module is Class::Accessor::Chained, and the vibe is: chained accessors. Slay. πŸ’…


✨ NAME ✨

Class::Accessor::Chained β€” make chained accessors. That's the whole assignment. πŸŽ€


πŸŽ€ SYNOPSIS πŸŽ€

package Foo;
use base qw( Class::Accessor::Chained );
__PACKAGE__->mk_accessors(qw( foo bar baz ));

my $foo = Foo->new->foo(1)->bar(2)->baz(4);
print $foo->bar; # prints 2

no cap, that chain is iconic. πŸ”₯


πŸ¦‹ DESCRIPTION πŸ¦‹

A chained accessor is literally the main-character accessor: it always returns the object when you call it with parameters (that's the setting era), and it returns the value of the field when you call it with no arguments (that's the getting era). 🫢

This module subclasses Class::Accessor in order to provide the same mk_accessors interface. Same interface, chained behaviour. Periodt. ✨


πŸ‘‘ AUTHOR πŸ‘‘

Richard Clamp <richardc@unixbeard.net> wrote this. Respect the icon. πŸ‘‘


Copyright (C) 2003 Richard Clamp. All Rights Reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Legal cutie behaviour, fr fr. πŸ’œ


πŸ’œ SEE ALSO πŸ’œ

  • Class::Accessor β€” go read this next, bestie.
  • Class::Accessor::Chained::Fast β€” and this one too. πŸ‘€

signing off with the deets: this page is from perl v5.42.0, dated 2010-12-01, and the manual name is Class::...Chained(3). mwah πŸ’‹

πŸ“¦ where this page comes from