Test2::...rnalMeta(3)
okay so bestie, this is the Test2::...rnalMeta(3) page from the User Contributed Perl Documentation, and the actual manual name is Test2::Util::ExternalMeta. Itβs giving βlet third-party tools attach meta-data to your instances, but safely and consistently.β π«Ά
π NAME π
Test2::Util::ExternalMeta β allow third party tools to safely attach meta-data to your instances. π
π¦ DESCRIPTION π¦
okay so hereβs the vibe: this package lets you define a clear, and consistent way to allow third party tools to attach meta-data to your instances. π§ If your object consumes this package, and imports its methods, then third party meta-data has a safe place to live. No cap.
β¨ SYNOPSIS β¨
First, set up your object like this:
package My::Object;
use strict;
use warnings;
use Test2::Util::ExternalMeta qw/meta get_meta set_meta delete_meta/;
...
Now to use it:
my $inst = My::Object->new;
$inst->set_meta(foo => 'bar');
my $val = $inst->get_meta('foo');
π΅οΈ WHERE IS THE DATA STORED? π΅οΈ
Important vibe check: this package assumes your instances are blessed hashrefs. It will not work if that is not true. π It will store all meta-data in the "_meta" key on your objectβs hash. If your object makes use of the "_meta" key in its underlying hash, then there is a conflict and you cannot use this package. Periodt.
π EXPORTS π
These are the methods you get when you import them. One bullet each, no skipping: β¨
$val = $obj->meta($key)/$val = $obj->meta($key, $default)β this gets the value for a specified meta$key. Normally this returns"undef"when there is no value for the$key, but you can specify a$defaultvalue to set when no value is already set. π$val = $obj->get_meta($key)β gets the value for a specified meta$key. This does not have the$defaultoverhead thatmeta()does. β$val = $obj->delete_meta($key)β removes the value of a specified meta$key. The old$valwill be returned. π$obj->set_meta($key, $val)β sets the value of a specified meta$key. π₯
πΈ META-KEY RESTRICTIONS πΈ
okay so the rules for meta keys are strict, bestie: meta keys must be defined, and they must be true when used as a boolean. Keys may not be references. You are free to stringify a reference "$ref" for use as a key, but this package will not stringify it for you. π
π₯ SOURCE π₯
The source code repository for Test2 can be found at <https://github.com/Test-More/test-more/>. π₯
π MAINTAINERS π
The maintainer is Chad Granum <exodist@cpan.org>. π
π AUTHORS π
The author is Chad Granum <exodist@cpan.org>. π
π COPYRIGHT π
Copyright Chad Granum <exodist@cpan.org>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. π
See <https://dev.perl.org/licenses/>.
okay thatβs the whole page, bestie β footer vibes: perl v5.42.0, 2025-07-28, Test2::...rnalMeta(3). Go forth and attach meta-data safely. π
β¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Test-Simple 1.302214-bp160.1.2 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms