NAME

MooX::TaggedAttributes::Cache - Extract information from a Tagged Attribute Cache

VERSION

version 0.15

SYNOPSIS

  $cache = MooX::TaggedAttributes::Cache->new( $class );

  $tags = $cache->tags;

DESCRIPTION

MooX::TaggedAttributes caches attribute tags as objects of this class. The user typically never instantiates objects of MooX::TaggedAttributes::Cache. Instead, they are returned by the _tags method added to tagged classes, e.g.

  $cache = $class->_tags;

CLASS METHODS

new

  $cache = MooX::TaggedAttributes::Cache( $class );

Create a cache object for the $class, which must have a _tag_list method.

METHODS

tag_hash

   $tags = $cache->tag_hash;

Returns a reference to a hash keyed off of the tags in the cache. The values are hashes which map attribute names to tag values.

Do Not Modify This Hash.

attr_hash

   $tags = $cache->tag_hash;

Returns a reference to a hash keyed off of the attributes in the cache. The values are hashes which map tag names to tag values.

Do Not Modify This Hash.

tags

   # return all of the tags as an array reference
   $tags = $cache->tags;

   # return the tags for the specified attribute as an array reference
   $tags = $cache->tags( $attr );

Returns a reference to an array containing tags.

Do Not Modify This Array.

value

   $value = $cache->value( $attr, $tag );

Return the value of a tag for the given attribute.

OVERLOAD

%{}

The object may be treated as a hash reference. It will operate on the reference returned by "tag_hash". For example,

  keys %{ $cache };

is equivalent to

  keys %{ $cache->tag_hash };

SUPPORT

Bugs

Please report any bugs or feature requests to bug-moox-taggedattributes@rt.cpan.org or through the web interface at: https://rt.cpan.org/Public/Dist/Display.html?Name=MooX-TaggedAttributes

Source

Source is available at

  https://gitlab.com/djerius/moox-taggedattributes

and may be cloned from

  https://gitlab.com/djerius/moox-taggedattributes.git

SEE ALSO

Please see those modules/websites for more information related to this module.

AUTHOR

Diab Jerius <djerius@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2018 by Smithsonian Astrophysical Observatory.

This is free software, licensed under:

  The GNU General Public License, Version 3, June 2007