Class::MakeMethods::Attribute - Declare generated subs
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');
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', );
You can not use the :MakeMethod attribute with lexical or anonymous subroutine declarations.
:MakeMethod
You called :MakeMethod() without the required method-type argument.
:MakeMethod()
See Attribute::Handlers byÊDamian Conway
Developed by:
M. Simon Cavalletto, Evolution Online Systems, simonm@evolution.com
Inspired by Attribute::Abstract and Attribute::Memoize by Marcel Grunauer.
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:
Non-ASCII character seen before =encoding in 'byÊDamian'. Assuming CP1252
To install Class::MakeMethods, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Class::MakeMethods
CPAN shell
perl -MCPAN -e shell install Class::MakeMethods
For more information on module installation, please visit the detailed CPAN module installation guide.