{
    "mode": "perldoc",
    "parameter": "Test2::Util::ExternalMeta",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Test2%3A%3AUtil%3A%3AExternalMeta/json",
    "generated": "2026-06-11T12:31:46Z",
    "synopsis": "package My::Object;\nuse strict;\nuse warnings;\nuse Test2::Util::ExternalMeta qw/meta getmeta setmeta deletemeta/;\n...\nNow to use it:\nmy $inst = My::Object->new;\n$inst->setmeta(foo => 'bar');\nmy $val = $inst->getmeta('foo');\nWHERE IS THE DATA STORED?\nThis package assumes your instances are blessed hashrefs, it will not work if that is not true.\nIt will store all meta-data in the \"meta\" key on your objects hash. If your object makes use of\nthe \"meta\" key in its underlying hash, then there is a conflict and you cannot use this\npackage.",
    "sections": {
        "NAME": {
            "content": "Test2::Util::ExternalMeta - Allow third party tools to safely attach meta-data to your\ninstances.\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This package lets you define a clear, and consistent way to allow third party tools to attach\nmeta-data to your instances. If your object consumes this package, and imports its methods, then\nthird party meta-data has a safe place to live.\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "package My::Object;\nuse strict;\nuse warnings;\n\nuse Test2::Util::ExternalMeta qw/meta getmeta setmeta deletemeta/;\n\n...\n\nNow to use it:\n\nmy $inst = My::Object->new;\n\n$inst->setmeta(foo => 'bar');\nmy $val = $inst->getmeta('foo');\n\nWHERE IS THE DATA STORED?\nThis package assumes your instances are blessed hashrefs, it will not work if that is not true.\nIt will store all meta-data in the \"meta\" key on your objects hash. If your object makes use of\nthe \"meta\" key in its underlying hash, then there is a conflict and you cannot use this\npackage.\n",
            "subsections": []
        },
        "EXPORTS": {
            "content": "$val = $obj->meta($key)\n$val = $obj->meta($key, $default)\nThis will get the value for a specified meta $key. Normally this will return \"undef\" when\nthere is no value for the $key, however you can specify a $default value to set when no\nvalue is already set.\n\n$val = $obj->getmeta($key)\nThis will get the value for a specified meta $key. This does not have the $default overhead\nthat \"meta()\" does.\n\n$val = $obj->deletemeta($key)\nThis will remove the value of a specified meta $key. The old $val will be returned.\n\n$obj->setmeta($key, $val)\nSet the value of a specified meta $key.\n",
            "subsections": []
        },
        "META-KEY RESTRICTIONS": {
            "content": "Meta keys must be defined, and must be true when used as a boolean. Keys may not be references.\nYou are free to stringify a reference \"$ref\" for use as a key, but this package will not\nstringify it for you.\n",
            "subsections": []
        },
        "SOURCE": {
            "content": "The source code repository for Test2 can be found at http://github.com/Test-More/test-more/.\n",
            "subsections": []
        },
        "MAINTAINERS": {
            "content": "Chad Granum <exodist@cpan.org>\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "Chad Granum <exodist@cpan.org>\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "Copyright 2020 Chad Granum <exodist@cpan.org>.\n\nThis program is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n\nSee http://dev.perl.org/licenses/\n",
            "subsections": []
        }
    },
    "summary": "Test2::Util::ExternalMeta - Allow third party tools to safely attach meta-data to your instances.",
    "flags": [],
    "examples": [],
    "see_also": []
}