Test2::...rnalMeta(3)

πŸ“¦ version 1.302214, in opensuse-leap 16.0

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 $default value 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 $default overhead that meta() does. ⭐
  • $val = $obj->delete_meta($key) β€” removes the value of a specified meta $key. The old $val will 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 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