1MakeMethods::Utility::IUnsheerriCtoanbtlrei(b3u)ted PerlMaDkoecMuemtehnotdast:i:oUntility::Inheritable(3)
2
3
4

NAME

6       Class::MakeMethods::Utility::Inheritable - "Inheritable" data
7

SYNOPSIS

9         package MyClass;
10         sub new { ... }
11
12         package MySubclass;
13         @ISA = 'MyClass';
14         ...
15         my $obj = MyClass->new(...);
16         my $subobj = MySubclass->new(...);
17
18         use Class::MakeMethods::Utility::Inheritable qw(get_vvalue set_vvalue );
19
20         my $dataset = {};
21         set_vvalue($dataset, 'MyClass', 'Foobar');    # Set value for class
22         get_vvalue($dataset, 'MyClass');              # Gets value "Foobar"
23
24         get_vvalue($dataset, $obj);                   # Objects "inherit"
25         set_vvalue($dataset, $obj, 'Foible');         # Until you override
26         get_vvalue($dataset, $obj);                   # Now finds "Foible"
27
28         get_vvalue($dataset, 'MySubclass');           # Subclass "inherits"
29         get_vvalue($dataset, $subobj);                # As do its objects
30         set_vvalue($dataset, 'MySubclass', 'Foozle'); # Until we override it
31         get_vvalue($dataset, 'MySubclass');           # Now finds "Foozle"
32
33         get_vvalue($dataset, $subobj);                # Change cascades down
34         set_vvalue($dataset, $subobj, 'Foolish');     # Until we override again
35
36         get_vvalue($dataset, 'MyClass');              # Superclass is unchanged
37

DESCRIPTION

39       This module provides several functions which allow you to store values
40       in a hash corresponding to both objects and classes, and to retrieve
41       those values by searching a object's inheritance tree until it finds a
42       matching entry.
43
44       This functionality is used by Class::MakeMethods::Standard::Inheritable
45       and Class::MakeMethods::Composite::Inheritable to construct methods
46       that can both store class data and be overriden on a per-object level.
47

REFERENCE

49       find_vself
50
51         $vself = find_vself( $dataset, $instance );
52
53       Searches $instance's inheritance tree until it finds a matching entry
54       in the dataset, and returns either the instance, the class that
55       matched, or undef.
56
57       get_vvalue
58
59         $value = get_vvalue( $dataset, $instance );
60
61       Searches $instance's inheritance tree until it finds a matching entry
62       in the dataset, and returns that value
63
64       set_vvalue
65
66         $value = set_vvalue( $dataset, $instance, $value );
67
68       Searches $instance's inheritance tree until it finds a matching entry
69       in the dataset, and returns that value
70
71
72
73perl v5.8.8                       2004-09-0M6akeMethods::Utility::Inheritable(3)
Impressum