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 val‐
27       ues.
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
38       The following methods from Generic should all be supported:
39
40         scalar
41         string
42         string_index (?)
43         number
44         boolean
45         bits (?)
46         array (*)
47         hash (*)
48         tiedhash (?)
49         hash_of_arrays (?)
50         object (?)
51         instance (?)
52         array_of_objects (?)
53         code (?)
54         code_or_scalar (?)
55
56       See Class::MakeMethods::Template::Generic for the interfaces and behav‐
57       iors of these method types.
58
59       The items marked with a * above are specifically defined in this pack‐
60       age, whereas the others are formed automatically by the interaction of
61       this package's generic settings with the code templates provided by the
62       Generic superclass.
63
64       The items marked with a ? above have not been tested sufficiently;
65       please inform the author if they do not function as you would expect.
66
67       PackageVar:vars
68
69       This rewrite rule converts package variable names into PackageVar meth‐
70       ods of the equivalent data type.
71
72       Here's an example declaration:
73
74         package MyClass;
75
76         use Class::MakeMethods::Template::PackageVar (
77           vars => '$DEBUG %Index'
78         );
79
80       MyClass now has methods that get and set the contents of its
81       $MyClass::DEBUG and %MyClass::Index package variables:
82
83         MyClass->DEBUG( 1 );
84         MyClass->Index( 'foo' => 'bar' );
85
86
87
88perl v5.8.8                       2004-09-0M6akeMethods::Template::PackageVar(3)
Impressum