Metaba...::Hash(3pm)
π Metabase::Fact::Hash π
okay bestie, quick vibe check: this is the Metabase::Fact::Hash(3pm) page, from the User Contributed Perl Documentation section, and it's literally the blueprint for making a fact that's just... a hash. simple. iconic. π
Version: 0.025 β¨
π SYNOPSIS
so like, first you define the fact class:
# defining the fact class
package MyComment;
use Metabase::Fact::Hash;
our @ISA = qw/Metabase::Fact::Hash/;
sub required_keys { qw/poster/ }
sub optional_keys { qw/comment/ }
sub content_metadata {
my $self = shift;
return {
poster => [ '//str' => $self->content->{poster} ],
};
}
sub validate_content {
my $self = shift;
$self->SUPER::validate_content; # required and optional keys
# other analysis of values
}
...and then... π«Ά
# using the fact class
my $fact = MyFact->new(
resource => 'RJBS/Metabase-Fact-0.001.tar.gz',
content => {
poster => 'larry',
comment => 'Metabase rocks!',
}
);
$client->send_fact($fact);
π DESCRIPTION
so here's the tea π«: many β and honestly, like, most β of the facts you're gonna store in a Metabase are just hashes of simple data. no drama, no frills. and Metabase::Fact::Hash is a subclass of Metabase::Fact with most of the required Fact methods already implemented for you. so if you write your class as a subclass of Metabase::Fact::Hash, you can just store simple hashes in it. periodt. π
you should implement required_keys and/or optional_keys the way the SYNOPSIS shows. the superclass valiate_content will make sure that required keys exist and that only required an optional keys exist. if you wanna get extra and validate the specific content of the hash handed to the constructor, you may wish to subclass validate_content. main character energy, do it.
you may also wish to implement a content_metadata method to generate metadata about the hash contents. β¨
lowkey important reminder: keep the spelling valiate_content exactly as it appears here β that's what the original says, and bestie, we do not "fix" the manpage. π
π ATTRIBUTES
Arguments provided to new
resourceβ required β¨ The canonical resource (URI) the Fact relates to. For CPAN distributions, this would be acpan:///distfile/URL. (See URI::cpan.)contentβ required π A reference to the actual information associated with the fact. The exact form of the content is up to each Fact class to determine β you decide, you're the boss.
π¦ METHODS
for the deets on the methods this class provides, go check out Metabase::Fact. iykyk π
π BUGS
please report any bugs or feature using the CPAN Request Tracker. Bugs can be submitted through the web interface at:
<http://rt.cpan.org/Dist/Display.html?Queue=Metabase-Fact>
when you're submitting a bug or a request, please include a test file or a patch to an existing test-file that illustrates the bug or the desired feature. receipts, bestie β bring receipts. π
πΈ AUTHORS
- David Golden
<dagolden@cpan.org> - Ricardo Signes
<rjbs@cpan.org> - H.Merijn Brand
<hmbrand@cpan.org>
π COPYRIGHT AND LICENSE
this software is Copyright (c) 2016 by David Golden.
this is free software, licensed under:
The Apache License, Version 2.0, January 2004
aaaand that's the whole page, no cap. π§ this was Metaba...::Hash(3pm), generated with perl v5.36.0 and dated 2022-10-14 β slay, go write some facts bestie πβ¨π
π¦ where this page comes from
- ubuntu noble: libmetabase-fact-perl 0.025-4 Β· Apache-2.0
- ubuntu resolute: libmetabase-fact-perl 0.025-4 Β· Apache-2.0
- ubuntu stonking: libmetabase-fact-perl 0.025-4 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms