additional docs
[gitmo/MooseX-MetaDescription.git] / lib / MooseX / MetaDescription.pm
index c848df4..3baa9e0 100644 (file)
@@ -23,33 +23,42 @@ MooseX::MetaDescription - A framework for adding additional metadata to Moose cl
     package Foo;
     use metaclass 'MooseX::MetaDescription::Meta::Class';
     use Moose;
-
+    
+    # add class-level metadata
     __PACKAGE__->meta->description->{'Hello'} = 'World';
 
     has 'bar' => (
         metaclass   => 'MooseX::MetaDescription::Meta::Attribute',
         is          => 'ro',
         isa         => 'Str',   
-        default     => sub { 'Foo::bar' },
+        default     => sub { Bar->new() },
+        # add attribute level metadata
         description => {
-            baz   => 'Foo::bar::baz',
+            node_type   => 'element',
         }
     );
 
-    ...
+    my $foo = Foo->new;
     
     $foo->meta->description; # { 'Hello' => 'World' }
-    $foo->meta->get_attribute('bar')->description; # { baz   => 'Foo::bar::baz' }    
+    
+    my $bar = $foo->meta->get_attribute('bar');
+    
+    # access the desciption HASH directly
+    $bar->description; # { node_type   => 'element' }    
+    
+    # or access the instance of MooseX::MetaDescription::Description
+    $bar->metadescription;
+    
+    # access the original attribute metaobject from the metadesc too
+    $bar->metadescription->descriptor == $bar;
 
 =head1 DESCRIPTION
 
-=head1 METHODS 
-
-=over 4
-
-=item B<>
-
-=back
+MooseX::MetaDescription allows you to add arbitrary out of band 
+metadata to your Moose classes and attributes. This will allow 
+you to track out of band data along with attributes, which is 
+very useful for say serializing Moose classes in HTML or XML.
 
 =head1 BUGS