KiokuD...::Data(3pm)

πŸ“¦
version 0.57 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu questing

✨ KiokuDB::Role::Upgrade::Data ✨

okay bestie, so this is a page from the User Contributed Perl Documentation section of the manual (that's the <3pm> part, iykyk) πŸ’… and it's literally all about a role that lets your classes handle their own data upgrades. no cap.


🌸 NAME 🌸

KiokuDB::Role::Upgrade::Data β€” classes that provide their own upgrade routine. periodt. πŸ’–


πŸŽ€ VERSION πŸŽ€

version 0.57 ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

okay so this is the vibe, fr fr:

with qw(KiokuDB::Role::Upgrade::Data);

sub kiokudb_upgrade_data {
    my ( $class, %args ) = @_;

    # convert the data from the old version of the class to the new version
    # as necessary

    $args{entry}->derive(
        class_version => our $VERSION,
        ...
    );
}

like. you consume the role, you write kiokudb_upgrade_data, and you're the main character of your own data conversion. πŸ‘‘


πŸ’– DESCRIPTION πŸ’–

This class lets you take complete control of the data conversion process. like, all of it. the whole thing. 🫢

heads up though: with this approach there is only one handler per class, not one handler per version. so it's giving "one big function to rule them all" energy, not "a lil function for every version" energy. πŸ’€

If you want something a bit more DWIM (aka "do what I mean, bestie"), go peek at KiokuDB::Role::Upgrade::Handlers::Table. and for even more of the details, KiokuDB::TypeMap::Entry::MOP is where it's at. 🌈


🌟 AUTHOR 🌟

Yuval Kogman <nothingmuch@woobling.org> β€” iconic, we stan. πŸ’œ


This software is copyright (c) 2014 by Yuval Kogman, Infinity Interactive.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. slay. ✨


and that's the whole page bestie!! this was perl v5.34.0, dated 2022-05-23, brought to you by the KiokuDB::Role::Upgrade::Data(3pm) manual page πŸ’– mwah, go upgrade your data responsibly πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from