Mixin:...Driver(3pm)
π NAME π
Mixin::ExtraFields::Driver β it's the backend storage bestie for extra fields, no cap. πΈ
Also hi, this page is User Contributed Perl Documentation, and it lives at Mixin:...Driver(3pm) in your man pages, iykyk.
β¨ VERSION β¨
version 0.140003 π
π¦ SYNOPSIS π¦
okay so real talk: this is genuinely not something you'd use on your own, bestie. It's just a lil helper that Mixin::ExtraFields uses behind the scenes. But if you insist... π
my $driver = Mixin::ExtraFields::Driver::Phlogiston->from_args(\%arg);
$driver->set($obj, $obj_id, flammable => "very!");
π DESCRIPTION π
Mixin::ExtraFields::Driver is a base class for the drivers that Mixin::ExtraFields uses β hence the name, slay. π
So a driver is expected to store and retrieve data keyed to an object and a name or key. It can store that however it wants, literally whatever, and it does not need to guarantee persistence across processes. So if your data ghosts you when the process ends? That's allowed. π
π§ PERL VERSION π§
This library should run on perls released even a long time ago. It should work on any version of perl released in the last five years. β
Although it may work on older versions of perl, no guarantee is made that the minimum required version will not be increased. The version may be increased for any reason, and there is no promise that patches will be accepted to lower the minimum required perl. So like. Don't come for her about your ancient perl. π
π SUBCLASSING π
All drivers must implement the four methods listed below. The base class has implementations of these methods, but those implementations will die noisily (confess-ing) when called. Dramatic? Yes. Iconic? Also yes. π
Almost all methods are passed the same data as their first two arguments: $object, the object for which the driver is to find or alter data, and $id, that object's unique id. While this may be slighly redundant, it keeps the id-finding call in one place. (Not me keeping the original typo "slighly" because it's part of the vibe π«Ά)
πΈ from_args
my $driver = Mixin::ExtraFields::Driver::Subclass->from_args(\%arg);
This method must return a driver object appropriate to the given args. It is not called new because it need not return a new object for each call to it. Returning identical objects for identical configurations may be safe for some driver implementations, and it is expressly allowed. So like, object reuse is a valid main character move. π₯
The arguments passed to this method are those given as the driver option to the fields import group in Mixin::ExtraFields, less the class option.
π get_all_detailed_extra
my %extra = $driver->get_all_detailed_extra($object, $id);
This method must return all available information about all existing extra fields for the given object. It must be returned as a list of name/value pairs. The values must be references to hashes. Each hash must have an entry for the key value giving the value for that name.
π set_extra
$driver->set_extra($object, $id, $name, $value);
This method must set the named extra to the given value. That's it, that's the job. π
π¦ delete_extra
$driver->delete_extra($object, $id, $name);
This method must delete the named extra, causing it to cease to exist. Gone. Ghosted. Periodt. π
β‘ OPTIMIZING β‘
The methods below can all be implemented in terms of those above. If they are not provided by the subclass, basic implementations exist. Those basic implementations may be less efficient than implementations crafted for the specifics of the storage engine behind the driver, so authors of driver subclasses should consider implementing these methods. Basically: it works, but it's giving slow. π
π get_all_extra
my %extra = $driver->get_all_extra($object, $id);
This method behaves like get_all_detailed_extra, above, but provides the entry's value, not a detailed hashref, as the value for each entry.
β get_extra
β get_detailed_extra
my $value = $driver->get_extra($object, $id, $name);
my $hash = $driver->get_detailed_extra($object, $id, $name);
These methods return a single value requested by name, either as the value itself or a detailed hashref describing it.
π get_all_extra_names
my @names = $driver->get_all_extra_names($object, $id);
This method returns the names of all existing extras for the given object. Just the names, bestie. β¨
π exists_extra
if ($driver->exists_extra($object, $id, $name)) { ... }
This method returns true if an entry exists for the given name and false otherwise. Vibe check: does it exist or not. π₯
π delete_all_extra
$driver->delete_all_extra($object, $id);
This method deletes all extras for the object, as per the delete_extra method.
πΈ AUTHOR πΈ
Ricardo Signes <cpan@semiotic.systems> β king behavior honestly π
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2022 by Ricardo Signes.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
and that's the whole page, bestie!! π this was Mixin:...Driver(3pm) from perl v5.36.0, dated 2023-01-07, mwah π go implement those four methods, slay, and hydrate!! πβ¨
π¦ where this page comes from
- debian bookworm: libmixin-extrafields-perl 0.140003-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libmixin-extrafields-perl 0.140003-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libmixin-extrafields-perl 0.140003-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libmixin-extrafields-perl 0.140003-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libmixin-extrafields-perl 0.140003-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms