line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::MakeMethods::Template::Global; |
2
|
|
|
|
|
|
|
|
3
|
10
|
|
|
10
|
|
46048
|
use Class::MakeMethods::Template::Generic '-isasubclass'; |
|
10
|
|
|
|
|
32
|
|
|
10
|
|
|
|
|
141
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
$VERSION = 1.008; |
6
|
10
|
|
|
10
|
|
74
|
use strict; |
|
10
|
|
|
|
|
21
|
|
|
10
|
|
|
|
|
904
|
|
7
|
|
|
|
|
|
|
require 5.0; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Class::MakeMethods::Template::Global - Method that are not instance-dependent |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 SYNOPSIS |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
package MyObject; |
16
|
|
|
|
|
|
|
use Class::MakeMethods::Template::Global ( |
17
|
|
|
|
|
|
|
scalar => [ 'foo' ] |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
package main; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
MyObject->foo('bar') |
23
|
|
|
|
|
|
|
print MyObject->foo(); |
24
|
|
|
|
|
|
|
... |
25
|
|
|
|
|
|
|
print $my_instance->foo(); # same thing |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 DESCRIPTION |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
These meta-methods access values that are shared across all instances |
30
|
|
|
|
|
|
|
of your object in your process. For example, a hash_scalar meta-method |
31
|
|
|
|
|
|
|
will be able to store a different value for each hash instance you |
32
|
|
|
|
|
|
|
call it on, but a static_scalar meta-method will return the same |
33
|
|
|
|
|
|
|
value for any instance it's called on, and setting it from any |
34
|
|
|
|
|
|
|
instance will change the value that all other instances see. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
B: The following parameters are defined for Static meta-methods. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=over 4 |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=item data |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
The shared value. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=back |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub generic { |
49
|
|
|
|
|
|
|
{ |
50
|
10
|
|
|
10
|
0
|
212
|
'-import' => { |
51
|
|
|
|
|
|
|
'Template::Generic:generic' => '*' |
52
|
|
|
|
|
|
|
}, |
53
|
|
|
|
|
|
|
'code_expr' => { |
54
|
|
|
|
|
|
|
_VALUE_ => '_ATTR_{data}', |
55
|
|
|
|
|
|
|
}, |
56
|
|
|
|
|
|
|
'params' => { |
57
|
|
|
|
|
|
|
'data' => undef, |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
######################################################################## |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 Standard Methods |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
The following methods from Generic should be supported: |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
scalar |
69
|
|
|
|
|
|
|
string |
70
|
|
|
|
|
|
|
number |
71
|
|
|
|
|
|
|
boolean |
72
|
|
|
|
|
|
|
bits (?) |
73
|
|
|
|
|
|
|
array |
74
|
|
|
|
|
|
|
hash |
75
|
|
|
|
|
|
|
tiedhash (?) |
76
|
|
|
|
|
|
|
hash_of_arrays (?) |
77
|
|
|
|
|
|
|
object |
78
|
|
|
|
|
|
|
instance |
79
|
|
|
|
|
|
|
array_of_objects (?) |
80
|
|
|
|
|
|
|
code |
81
|
|
|
|
|
|
|
code_or_scalar (?) |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
See L for the interfaces and behaviors of these method types. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
The items marked with a ? above have not been tested sufficiently; please inform the author if they do not function as you would expect. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 SEE ALSO |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
See L for general information about this distribution. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
See L for more about this family of subclasses. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
See L for information about the various accessor interfaces subclassed herein. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |