1MakeMethods::Standard(3U)ser Contributed Perl DocumentatiMoankeMethods::Standard(3)
2
3
4

NAME

6       Class::MakeMethods::Standard - Make common object accessors
7

SYNOPSIS

9         package MyObject;
10         use Class::MakeMethods::Standard::Hash (
11           new => 'new',
12           scalar => [ 'foo', 'bar' ],
13           array => 'my_list',
14           hash => 'my_index',
15         );
16

DESCRIPTION

18       This document describes the various subclasses of Class::MakeMethods
19       included under the Standard::* namespace, and the method types each one
20       provides.
21
22       The Standard subclasses provide a parameterized set of method-
23       generation implementations.
24
25       Subroutines are generated as closures bound to a hash containing the
26       method name and (optionally) additional parameters.
27
28   Calling Conventions
29       When you "use" a subclass of this package, the method declarations you
30       provide as arguments cause subroutines to be generated and installed in
31       your module. You can also omit the arguments to "use" and instead make
32       methods at runtime by passing the declarations to a subsequent call to
33       "make()".
34
35       You may include any number of declarations in each call to "use" or
36       "make()". If methods with the same name already exist, earlier calls to
37       "use" or "make()" win over later ones, but within each call, later
38       declarations superceed earlier ones.
39
40       You can install methods in a different package by passing
41       "-target_class => package" as your first arguments to "use" or "make".
42
43       See "USAGE" in Class::MakeMethods for more details.
44
45   Declaration Syntax
46       The following types of Simple declarations are supported:
47
48       ·   generator_type => 'method_name'
49
50       ·   generator_type => 'name_1 name_2...'
51
52       ·   generator_type => [ 'name_1', 'name_2', ...]
53
54       For a list of the supported values of generator_type, see "STANDARD
55       CLASSES" in Class::MakeMethods::Docs::Catalog, or the documentation for
56       each subclass.
57
58       For each method name you provide, a subroutine of the indicated type
59       will be generated and installed under that name in your module.
60
61       Method names should start with a letter, followed by zero or more
62       letters, numbers, or underscores.
63
64   Parameter Syntax
65       The Standard syntax also provides several ways to optionally associate
66       a hash of additional parameters with a given method name.
67
68       ·   generator_type => [
69               'name_1' => { param=>value... }, ...
70             ]
71
72           A hash of parameters to use just for this method name.
73
74           (Note: to prevent confusion with self-contained definition hashes,
75           described below, parameter hashes following a method name must not
76           contain the key 'name'.)
77
78       ·   generator_type => [
79               [ 'name_1', 'name_2', ... ] => { param=>value... }
80             ]
81
82           Each of these method names gets a copy of the same set of
83           parameters.
84
85       ·   generator_type => [
86               { 'name'=>'name_1', param=>value... }, ...
87             ]
88
89           By including the reserved parameter 'name', you create a self-
90           contained declaration with that name and any associated hash
91           values.
92
93       Simple declarations, as shown in the prior section, are treated as if
94       they had an empty parameter hash.
95

SEE ALSO

97       See Class::MakeMethods for general information about this distribution.
98
99
100
101perl v5.28.1                      2003-09-06          MakeMethods::Standard(3)
Impressum