GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
MakeMethods::Composite(3) User Contributed Perl Documentation MakeMethods::Composite(3)

Class::MakeMethods::Composite - Make extensible compound methods

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

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.

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.

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.

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 Class::MakeMethods for general information about this distribution.

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

2004-09-06 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.