SYNOPSIS

  package MyObject;
  use Class::MakeMethods::Composite::Hash (
    new => 'new',
    scalar => [ 'foo', 'bar' ],
    array => 'my_list',
    hash => 'my_index',
  );

DESCRIPTION

This document describes the various subclasses of Class::MakeMethods included under the Composite::* namespace, and the method types each one provides.

The Composite subclasses provide a parameterized set of method-generation implementations.

Subroutines are generated as closures bound to a hash containing the method name and additional parameters, including the arrays of subroutine references that will provide the method's functionality.

Calling Conventions

When you \*(C`use\*(C' this package, the method names you provide as arguments cause subroutines to be generated and installed in your module.

See \*(L"Calling Conventions\*(R" in Class::MakeMethods::Standard for more information.

Declaration Syntax

To declare methods, pass in pairs of a method-type name followed by one or more method names.

Valid method-type names for this package are listed in \*(L"\s-1METHOD\s0 \s-1GENERATOR\s0 \s-1TYPES\s0\*(R".

See \*(L"Declaration Syntax\*(R" in Class::MakeMethods::Standard and \*(L"Parameter Syntax\*(R" in Class::MakeMethods::Standard for more information.

About Composite Methods

The methods generated by Class::MakeMethods::Composite are assembled from groups of \*(L"fragment\*(R" subroutines, each of which provides some aspect of the method's behavior.

You can add pre- and post- operations to any composite method.

package MyObject; use Class::MakeMethods::Composite::Hash ( new => 'new', scalar => [ 'foo' => { 'pre_rules' => [ sub { # Don't automatically convert list to array-ref croak "Too many arguments" if ( scalar @_ > 2 ); } ], 'post_rules' => [ sub { # Don't let anyone see my credit card number! ${(pop)->{result}} =~ s/\d{13,16}/****/g; } ], } ], );

RELATED TO Class::MakeMethods::Composite…

See Class::MakeMethods for general information about this distribution.

For distribution, installation, support, copyright and license information, see Class::MakeMethods::Docs::ReadMe.