Perlan...Config(3pm)
π Perlanet::Role::Config β the manual, but make it cute π
okay so bestie, this is Perlanet::Role::Config(3pm), a page from the User Contributed Perl Documentation section of your local perl install. it's giving role, it's giving trait infrastructure, and honestly? iconic. let's get into it π«Ά
β¨ NAME β¨
Perlanet::Role::Config β a role to be used in Perlanet traits that read config. literally what it says on the tin, no cap.
β¨ SYNOPSIS β¨
so here's the vibe, exactly as written, character for character:
package Perlanet::Trait::MyConfig;
use Moose::Role;
with 'Perlanet::Role::Config';
# Class method to return the config
sub get_config_from_somewhere {
my $class = shift;
# get_config() is defined in this role
return $class->get_config(@_)
}
# get_config() calls this to actually read the config.
sub read_config {
my $class = shift;
my %params = @_;
my $cfg = ...;
return $cfg;
}
see how you with 'Perlanet::Role::Config'; and suddenly you're that girl? yeah. that's the whole bit. π
β¨ DESCRIPTION β¨
it's a role π and its job is to build Perlanet traits that read config information from various sources. like, various. wherever. she's flexible.
this role does two things, and she does them well:
- it exposes a method called
get_config()which gets the raw config data (using yourread_config()method). lowkey the main character of this whole operation. - it forces your trait to define a method called
read_config()which actually reads the config and returns it as a hash reference. noread_config(), no service. periodt.
β¨ METHODS β¨
πΈ get_config
calls your read_config() method to actually get the config data (as a hash reference) and then munges that data in various ways to get a useful config hash. she takes the raw stuff and she stylizes it. munge is such a fun word honestly.
π¦ THIRTY_DAYS
constant to define the default cache expiration time in seconds. that's it, that's the whole thing β thirty days of vibes, measured in seconds, because computers are like that. β
β¨ AUTHOR β¨
Dave Cross, <dave@perlhacks.com> β shoutout to the author, we love a credited legend π
β¨ COPYRIGHT AND LICENSE β¨
Copyright (c) 2022 by Magnum Solutions Ltd. π
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available. free as in slay, bestie.
and that's the whole page fr fr β this one's perl v5.36.0, dated 2023-02-21, brought to you by the same Perlan...Config(3pm) energy you started with. stay munging, bestie ππ§π
π¦ where this page comes from
- debian bookworm: libperlanet-perl 2.2.1-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libperlanet-perl 2.2.1-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libperlanet-perl 2.2.1-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu questing: libperlanet-perl 2.2.1-1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms