Data::Couplet::Extension - A convenient way for sub classing Data::Couplet with minimal effort
version 0.02004314
package My::DC; use Data::Couplet::Extension -with [qw( Plugin )]; __PACKAGE__->meta->make_immutable; 1;
This provides a handy way to subclass Data::Couplet, glue a bunch of DC plug-ins into it, and just use it.
The alternative ways, while working, are likely largely suboptimal ( applying roles to instances, yuck );
This gives you an easy way to create a sub class of Data::Couplet, and possibly tack on some of your own methods directly.
Makes the calling package a Data::Couplet subclass.
Data::Couplet::Extension->import( -into => ( $target || caller ), -base => ( $name || '' ), -with => ( [qw( PluginA PluginB )] || [] ), );
This is a convenience parameter, to make it easier to do via a 3rd party.
If not set, its automatically set to scalar caller();
scalar caller()
This is also mostly a convenience parameter, at this time, the only reason you'd want to set this to something, would be if you wanted to extend the Data::Couplet::Private core, and that's recommended only for experts who don't like our interface.
Incidentally, we use this to make Data::Couplet.
You can't set this yourself, we overwrite it, but this documentation is here to clarify how it works.
This is the expansion of -base. '' becomes 'Data::Couplet' ( which is the default ) and all other values become 'Data::Couplet::' . $value;
-base
This is then used via Moose extends to define your packages base class.
extends
This one you probably want the most. Its semantically the same as Moose's with, except that for convenience, all values of name are expanded to Data::Couplet::name and various tests are done on them to make sure they are compatible.
with
name
Data::Couplet::name
You can leave this empty, but you're not maximising the point of this utility unless you fill it.
You can't set this, we overwrite it. It gets populated from -with by simple expansion, Data::Couplet::Plugin::$value.
-with
Data::Couplet::Plugin::$value
These are fed to Moose's with method on your package
Seeing the only things we import come from Moose anyway, this is just
goto \&Moose::unimport;
Kent Fredric <kentnl at cpan.org>
This software is copyright (c) 2011 by Kent Fredric.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Data::Couplet, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Couplet
CPAN shell
perl -MCPAN -e shell install Data::Couplet
For more information on module installation, please visit the detailed CPAN module installation guide.