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.140002
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

SUBCLASSING

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

OPTIMIZING

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

AUTHOR

109       Ricardo Signes <rjbs@cpan.org>
110
112       This software is copyright (c) 2013 by Ricardo Signes.
113
114       This is free software; you can redistribute it and/or modify it under
115       the same terms as the Perl 5 programming language system itself.
116
117
118
119perl v5.34.0                      2022-01-21     Mixin::ExtraFields::Driver(3)
Impressum