1Mixin::ExtraFields::DriUvseerr(3C)ontributed Perl DocumeMnitxaitni:o:nExtraFields::Driver(3)
2
3
4

NAME

6       Mixin::ExtraFields::Driver - a backend for extra field storage
7

VERSION

9       version 0.140003
10

SYNOPSIS

12       This is really not something you'd use on your own, it's just used by
13       Mixin::ExtraFields, but if you insist...
14
15         my $driver = Mixin::ExtraFields::Driver::Phlogiston->from_args(\%arg);
16
17         $driver->set($obj, $obj_id, flammable => "very!");
18

DESCRIPTION

20       Mixin::ExtraFields::Driver is a base class for drivers used by
21       Mixin::ExtraFields -- hence the name.  A driver is expected to store
22       and retrieve data keyed to an object and a name or key.  It can store
23       this in any way it likes, and does not need to guarantee persistence
24       across processes.
25

PERL VERSION

27       This library should run on perls released even a long time ago.  It
28       should work on any version of perl released in the last five years.
29
30       Although it may work on older versions of perl, no guarantee is made
31       that the minimum required version will not be increased.  The version
32       may be increased for any reason, and there is no promise that patches
33       will be accepted to lower the minimum required perl.
34

SUBCLASSING

36       All drivers must implement the four methods listed below.  The base
37       class has implementations of these methods which will die noisily
38       ("confess"-ing) when called.
39
40       Almost all methods are passed the same data as their first two
41       arguments: $object, the object for which the driver is to find or alter
42       data, and $id, that object's unique id.  While this may be slighly
43       redundant, it keeps the id-finding call in one place.
44
45   from_args
46         my $driver = Mixin::ExtraFields::Driver::Subclass->from_args(\%arg);
47
48       This method must return a driver object appropriate to the given args.
49       It is not called "new" because it need not return a new object for each
50       call to it.  Returning identical objects for identical configurations
51       may be safe for some driver implementations, and it is expressly
52       allowed.
53
54       The arguments passed to this method are those given as the "driver"
55       option to the "fields" import group in Mixin::ExtraFields, less the
56       "class" option.
57
58   get_all_detailed_extra
59         my %extra = $driver->get_all_detailed_extra($object, $id);
60
61       This method must return all available information about all existing
62       extra fields for the given object.  It must be returned as a list of
63       name/value pairs.  The values must be references to hashes.  Each hash
64       must have an entry for the key "value" giving the value for that name.
65
66   set_extra
67         $driver->set_extra($object, $id, $name, $value);
68
69       This method must set the named extra to the given value.
70
71   delete_extra
72         $driver->delete_extra($object, $id, $name);
73
74       This method must delete the named extra, causing it to cease to exist.
75

OPTIMIZING

77       The methods below can all be implemented in terms of those above.  If
78       they are not provided by the subclass, basic implementations exist.
79       These implementations may be less efficient than implementations
80       crafted for the specifics of the storage engine behind the driver, so
81       authors of driver subclasses should consider implementing these
82       methods.
83
84   get_all_extra
85         my %extra = $driver->get_all_extra($object, $id);
86
87       This method behaves like "get_all_detailed_extra", above, but provides
88       the entry's value, not a detailed hashref, as the value for each entry.
89
90   get_extra
91   get_detailed_extra
92         my $value = $driver->get_extra($object, $id, $name);
93
94         my $hash = $driver->get_detailed_extra($object, $id, $name);
95
96       These methods return a single value requested by name, either as the
97       value itself or a detailed hashref describing it.
98
99   get_all_extra_names
100         my @names = $driver->get_all_extra_names($object, $id);
101
102       This method returns the names of all existing extras for the given
103       object.
104
105   exists_extra
106         if ($driver->exists_extra($object, $id, $name)) { ... }
107
108       This method returns true if an entry exists for the given name and
109       false otherwise.
110
111   delete_all_extra
112         $driver->delete_all_extra($object, $id);
113
114       This method deletes all extras for the object, as per the
115       "delete_extra" method.
116

AUTHOR

118       Ricardo Signes <cpan@semiotic.systems>
119
121       This software is copyright (c) 2022 by Ricardo Signes.
122
123       This is free software; you can redistribute it and/or modify it under
124       the same terms as the Perl 5 programming language system itself.
125
126
127
128perl v5.36.0                      2023-01-20     Mixin::ExtraFields::Driver(3)
Impressum