GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  TEST2::UTIL::EXTERNALMETA (3)

.ds Aq ’

NAME

Test2::Util::ExternalMeta - Allow third party tools to safely attach meta-data to your instances.

CONTENTS

EXPERIMENTAL RELEASE

This is an experimental release. Using this right now is not recommended.

DESCRIPTION

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.

SYNOPSYS



    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?

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

$val = $obj->meta($key)
$val = $obj->meta($key, $default) This will get the value for a specified meta $key. Normally this will return undef when there is no value for the $key, however you can specfi a $default value to set when no value is already set.
$val = $obj->get_meta($key) This will get the value for a specified meta $key. This does not have the $default overhead that meta() does.
$val = $obj->delete_meta($key) This will remove the value of a specified meta $key. The old $val will be returned.
$obj->set_meta($key, $val) Set the value of a specified meta $key.

META-KEY RESTICTIONS

Meta 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.

SOURCE

The source code repository for Test2 can be found at http://github.com/Test-More/Test2/.

MAINTAINERS

Chad Granum <exodist@cpan.org>

AUTHORS

Chad Granum <exodist@cpan.org>

COPYRIGHT

Copyright 2015 Chad Granum <exodist7@gmail.com>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://dev.perl.org/licenses/

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 TEST2::UTIL::EXTERNALMETA (3) 2016-04-01

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.