![]() |
![]()
| ![]() |
![]()
NAMETest2::Util::ExternalMeta - Allow third party tools to safely attach meta-data to your instances. DESCRIPTIONThis 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. SYNOPSISpackage 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?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 objects 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. EXPORTS
META-KEY RESTRICTIONSMeta keys must be defined, and 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. SOURCEThe source code repository for Test2 can be found at <https://github.com/Test-More/test-more/>. MAINTAINERSAUTHORSCOPYRIGHTCopyright 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/>
|