1MakeMethods::Template::UPsaecrkaCgoenVtarri(b3u)ted PerlMaDkoecMuemtehnotdast:i:oTnemplate::PackageVar(3)
2
3
4

NAME

6       Class::MakeMethods::Template::PackageVar - Static methods with global
7       variables
8

SYNOPSIS

10         package MyObject;
11         use Class::MakeMethods::Template::PackageVar (
12           scalar          => [ 'foo' ]
13         );
14
15         package main;
16
17         MyObject->foo('bar')
18         print MyObject->foo();
19
20         $MyObject::foo = 'bazillion';
21         print MyObject->foo();
22

DESCRIPTION

24       These meta-methods provide access to package (class global) variables.
25       These are essentially the same as the Static meta-methods, except that
26       they use a global variable in the declaring package to store their
27       values.
28
29       Common Parameters: The following parameters are defined for PackageVar
30       meta-methods.
31
32       variable
33           The name of the variable to store the value in. Defaults to the
34           same name as the method.
35
36   Standard Methods
37       The following methods from Generic should all be supported:
38
39         scalar
40         string
41         string_index (?)
42         number
43         boolean
44         bits (?)
45         array (*)
46         hash (*)
47         tiedhash (?)
48         hash_of_arrays (?)
49         object (?)
50         instance (?)
51         array_of_objects (?)
52         code (?)
53         code_or_scalar (?)
54
55       See Class::MakeMethods::Template::Generic for the interfaces and
56       behaviors of these method types.
57
58       The items marked with a * above are specifically defined in this
59       package, whereas the others are formed automatically by the interaction
60       of this package's generic settings with the code templates provided by
61       the Generic superclass.
62
63       The items marked with a ? above have not been tested sufficiently;
64       please inform the author if they do not function as you would expect.
65
66   PackageVar:vars
67       This rewrite rule converts package variable names into PackageVar
68       methods of the equivalent data type.
69
70       Here's an example declaration:
71
72         package MyClass;
73
74         use Class::MakeMethods::Template::PackageVar (
75           vars => '$DEBUG %Index'
76         );
77
78       MyClass now has methods that get and set the contents of its
79       $MyClass::DEBUG and %MyClass::Index package variables:
80
81         MyClass->DEBUG( 1 );
82         MyClass->Index( 'foo' => 'bar' );
83
84
85
86perl v5.38.0                      2023-07-2M0akeMethods::Template::PackageVar(3)
Impressum