« blib/lib/Class/MakeMethods/Template/Class.pm
↑ Summary
blib/lib/Class/MakeMethods/Template/Scalar.pm »
| 1 | package Class::MakeMethods::Template::Global; | ||
| 2 | |||
| 3 | 6 | ▶ | use Class::MakeMethods::Template::Generic '-isasubclass'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 6 | $VERSION = 1.008; | |
| 6 | 6 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 6 | 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<Common Parameters>: 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 | 6 | ▶ | sub generic { |
|
Subroutine
generic: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 49 | { | ||
| 50 | 6 | '-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<Class::MakeMethods::Template::Generic> 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<Class::MakeMethods> for general information about this distribution. | ||
| 90 | |||
| 91 | See L<Class::MakeMethods::Template> for more about this family of subclasses. | ||
| 92 | |||
| 93 | See L<Class::MakeMethods::Template::Generic> for information about the various accessor interfaces subclassed herein. | ||
| 94 | |||
| 95 | =cut | ||
| 96 | |||
| 97 | 6 | 1; | |