1 package MooseX::MetaDescription;
5 our $AUTHORITY = 'cpan:STEVAN';
7 use MooseX::MetaDescription::Meta::Class;
8 use MooseX::MetaDescription::Meta::Attribute;
9 use MooseX::MetaDescription::Description;
19 MooseX::MetaDescription - A framework for adding additional metadata to Moose classes
24 use metaclass 'MooseX::MetaDescription::Meta::Class';
27 # add class-level metadata
28 __PACKAGE__->meta->description->{'Hello'} = 'World';
31 metaclass => 'MooseX::MetaDescription::Meta::Attribute',
34 default => sub { Bar->new() },
35 # add attribute level metadata
37 node_type => 'element',
43 $foo->meta->description; # { 'Hello' => 'World' }
45 my $bar = $foo->meta->get_attribute('bar');
47 # access the desciption HASH directly
48 $bar->description; # { node_type => 'element' }
50 # or access the instance of MooseX::MetaDescription::Description
51 $bar->metadescription;
53 # access the original attribute metaobject from the metadesc too
54 $bar->metadescription->descriptor == $bar;
58 MooseX::MetaDescription allows you to add arbitrary out of band
59 metadata to your Moose classes and attributes. This will allow
60 you to track out of band data along with attributes, which is
61 very useful for say serializing Moose classes in HTML or XML.
65 All complex software has bugs lurking in it, and this module is no
66 exception. If you find a bug please either email me, or add the bug
71 Code and Design originally by Jonathan Rockway in the Ernst module,
72 extracted and refactored by:
74 Stevan Little E<lt>stevan.little@iinteractive.comE<gt>
76 =head1 COPYRIGHT AND LICENSE
78 Copyright 2008 Infinity Interactive, Inc.
80 L<http://www.iinteractive.com>
82 This library is free software; you can redistribute it and/or modify
83 it under the same terms as Perl itself.