Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

class::makemethods::composite(3pm) [debian man page]

MakeMethods::Composite(3pm)				User Contributed Perl Documentation			       MakeMethods::Composite(3pm)

NAME
Class::MakeMethods::Composite - Make extensible compound methods 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 "use" this package, the method names you provide as arguments cause subroutines to be generated and installed in your module. See "Calling Conventions" 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 "METHOD GENERATOR TYPES". See "Declaration Syntax" in Class::MakeMethods::Standard and "Parameter Syntax" in Class::MakeMethods::Standard for more information. About Composite Methods The methods generated by Class::MakeMethods::Composite are assembled from groups of "fragment" 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; } ], } ], ); SEE ALSO
See Class::MakeMethods for general information about this distribution. For distribution, installation, support, copyright and license information, see Class::MakeMethods::Docs::ReadMe. perl v5.10.1 2004-09-06 MakeMethods::Composite(3pm)

Check Out this Related Man Page

MakeMethods::Attribute(3pm)				User Contributed Perl Documentation			       MakeMethods::Attribute(3pm)

NAME
Class::MakeMethods::Attribute - Declare generated subs with attribute syntax SYNOPSIS
package MyObject; use Class::MakeMethods::Attribute 'Standard::Hash'; sub new :MakeMethod('new'); sub foo :MakeMethod('scalar'); sub bar :MakeMethod('scalar', { hashkey => 'bar_data' }); sub debug :MakeMethod('Standard::Global:scalar'); DESCRIPTION
This package allows common types of methods to be generated via a subroutine attribute declaration. (Available in Perl 5.6 and later.) Adding the :MakeMethod() attribute to a subroutine declaration causes Class::MakeMethods to create and install a subroutine based on the parameters given to the :MakeMethod attribute. You can declare a default method-generation class by passing the name of a MakeMethods subclass in the use Class::MakeMethods::Attribute statement. This default method-generation class will also apply as the default to any subclasses declared at compile time. If no default method-generation class is selected, you will need to fully-qualify all method type declarations. EXAMPLE
Here's a typical use of Class::MakeMethods::Attribute: package MyObject; use Class::MakeMethods::Attribute 'Standard::Hash'; sub new :MakeMethod('new'); sub foo :MakeMethod('scalar'); sub bar :MakeMethod('scalar', { hashkey => 'bar_data' }); sub debug :MakeMethod('Standard::Global:scalar'); package MySubclass; use base 'MyObject'; sub bazzle :MakeMethod('scalar'); This is equivalent to the following explicit Class::MakeMethods invocations: package MyObject; use Class::MakeMethods ( -MakerClass => 'Standard::Hash', new => 'new', scalar => 'foo', scalar => [ 'ba', { hashkey => 'bar_data' } ], 'Standard::Global:scalar' => 'debug', ); package MySubclass; use base 'MyObject'; use Class::MakeMethods ( -MakerClass => 'Standard::Hash', scalar => 'bazzle', ); DIAGNOSTICS
The following warnings and errors may be produced when using Class::MakeMethods::Attribute to generate methods. (Note that this list does not include run-time messages produced by calling the generated methods, or the standard messages produced by Class::MakeMethods.) Can't apply MakeMethod attribute to %s declaration. You can not use the ":MakeMethod" attribute with lexical or anonymous subroutine declarations. No method type provided for MakeMethod attribute. You called ":MakeMethod()" without the required method-type argument. SEE ALSO
See Attribute::Handlers byEDamian Conway. See Class::MakeMethods for general information about this distribution. perl v5.10.1 2004-09-06 MakeMethods::Attribute(3pm)
Man Page