BackPA...AsHash(3pm)
β¨ BackPAN::Index::Role::AsHash β¨
okay bestie, so this is a page from the User Contributed Perl Documentation collection β it's BackPAN::Index::Role::AsHash, a Perl role (that's a 3pm manpage, iykyk) whose whole entire job is to dump an object's data out as a plain old hash. π
πΈ NAME πΈ
BackPAN::Index::Role::AsHash β a role to dump object data as a hash π
π¦ SYNOPSIS π¦
use BackPAN::Index::Role::AsHash;
sub data_methods { return qw(list of data methods) }
π DESCRIPTION π
It's a role. Its purpose in life? To implement <as_hash> in your result objects. That's it, that's the whole vibe. β¨
π§ Requires
the receiving class β yes, you, the one who's consuming this role β must implement the following:
data_methods
my @methods = $self->data_methods;
Hands you back a list of methods that get data about the object. That's the list of stuff the role is gonna go grab. π
π Implements
as_hash
my $hash = $self->as_hash;
Produces a hash reference representing the object's data, and it builds that whole thing based on <$self->data_methods>. Every key is a method name, and every value is <$self->$method> β so basically it's a cute little method-name β method-result situation. π₯
ngl that's genuinely the entire module. short queen, does one thing, does it well. periodt. π
and that's a wrap on BackPAN::Index::Role::AsHash π«Ά this page came to you courtesy of perl v5.42.0, dated 2025-07-25 β go forth and hash responsibly, bestie π
β¨
π¦ where this page comes from
- fedora 43: perl-BackPAN-Index 0.42-35.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