Matthew Simon Cavalletto

NAME

Class::MakeMethods::Attribute - Declare generated subs

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.

Adding the :MakeMethod() attribute to a subroutine declaration causes Class::MakeMethods to create and install a subroutine based on the :MakeMethod parameters.

In particular, the example presented in the SYNOPSIS is equivalent to the following Class::MakeMethods declaration:

  package MyObject;
  use Class::MakeMethods ( 
    -MakerClass => 'Standard::Hash',
    new => 'new',
    scalar => 'foo',
    scalar => [ 'bar_accessor', { hashkey => 'bar' } ],
    'Standard::Global:scalar' => 'debug',
  );

DIAGNOSTICS

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 byÊDamian Conway

AUTHOR

Developed by:

  M. Simon Cavalletto, Evolution Online Systems, simonm@evolution.com

Inspired by Attribute::Abstract and Attribute::Memoize by Marcel Grunauer.

LICENSE

This module is free software. It may be used, redistributed and/or modified under the same terms as Perl.

Copyright (c) 2001 Evolution Online Systems, Inc.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 100:

Non-ASCII character seen before =encoding in 'byÊDamian'. Assuming ISO8859-1