Kent Fredric πŸ”₯🐢🍡πŸ”₯
and 1 contributors


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 )];

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.

    -into => ( $target || caller ),
    -base => ( $name   || ''     ),
    -with => ( [qw( PluginA PluginB )] || [] ),

-into => $target

This is a convenience parameter, to make it easier to do via a 3rd party.

If not set, its automatically set to scalar caller();

-base => $name

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.

-base_package => $name

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;

This is then used via Moose extends to define your packages base class.

-with => [qw( name )]

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.

You can leave this empty, but you're not maximising the point of this utility unless you fill it.

-with_expanded => [qw( name )]

You can't set this, we overwrite it. It gets populated from -with by simple expansion, 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>


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.