Some more documentation updates.
[gitmo/MooseX-AttributeHelpers.git] / lib / MooseX / AttributeHelpers / Composite / Trait.pm
index 634f2b9..1a75d47 100644 (file)
@@ -42,3 +42,88 @@ after install_accessors => sub {
 };
 
 1;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+MooseX::AttributeHelpers::Composite:Trait
+
+=head1 SYNOPSIS
+
+    package Foo;
+    use Moose;
+    use MooseX::AttributeHelpers;
+    
+    has foo => (
+        #metaclass => 'Composite',
+        traits    => ['MooseX::AttributeHelpers::Composite::Trait'],
+        is        => 'ro',
+        isa       => 'Int',
+        default   => 0,
+        provides  => {
+            Counter => {
+                inc   => 'inc_foo',
+                reset => 'reset_foo',
+            },
+            Number => {
+                mul   => 'mul_foo',
+            },
+            # My::Method::Provider => {
+            #     some_method => 'foo_method',
+            #},
+        },
+    );
+    
+    package main;
+    
+    my $foo = Foo->new;
+    $foo->inc_foo;
+    $foo->mul_foo(3);
+    print $foo->foo . "\n";
+    # 3
+
+=head1 DESCRIPTION
+
+This is an expansion on the basic L<MooseX::AttributeHelpers> idea, allowing you
+to compose the methods provided by the various
+L<MethodProviders|MooseX::AttributeHelpers::MethodProvider> without naming
+conflicts.  In addition, this module provides a way to get these helper
+methods without being locked into a particular
+L<metaclass|MooseX::AttributeHelpers::Composite>, as it is simply a role with
+a provides attribute and a method modifier.  It cannot, however, be used with
+old-style AttributeHelpers - the 'provides' name will conflict.
+
+=head1 ATTRIBUTES
+
+=over 4
+
+=item provides
+
+The map that tells Composite which methods from which providers you would like
+installed under which names.  It follows the format 
+
+    ProviderName => {
+        provided_method => desired_method_name,
+        ...
+    },
+    AnotherProvider => {
+        ...
+    },
+    ...
+
+=back
+
+=head1 BUGS
+
+All complex software has bugs lurking in it, and this module is no
+exception. If you find a bug please either email me, or add the bug
+to cpan-RT.
+
+=head1 AUTHOR
+
+Paul Driver E<lt>frodwith@cpan.orgE<gt>
+
+=cut