DBIx::...ypeEnum(3pm)
π DBIx::Class::InflateColumn::ClassTypeEnum β the vibe check π
okay so bestie, you know those Perl manual pages that read like a robot explaining taxes? yeah. this one is from the User Contributed Perl Documentation, which is basically the group chat of Perl docs, and honestly? it's serving.
β¨ NAME β¨
DBIx::Class::InflateColumn::ClassTypeEnum β inflate enum-like columns into your Class::Type::Enum classes. no cap, that's the whole job and it does it beautifully. π
πΈ VERSION πΈ
version 0.014 β she's got a version number and she's proud of it. β¨
π SYNOPSIS π
here's the moment you've all been waiting for, the copy-paste-able glow-up:
package My::Schema::Result::Toast {
__PACKAGE__->load_components(qw/ InflateColumn::ClassTypeEnum Core /);
# Assuming Toast::Status is one of your enum classes...
use Toast::Status; # Ensure it is loaded.
__PACKAGE__->add_columns(
status => {
data_type => 'varchar',
extra => {
enum_class => 'Toast::Status',
},
}
);
}
yes bestie, your schema result package is literally called Toast. iconic behavior. π
π DESCRIPTION π
so what's actually happening here: this component takes your DBIC columns and inflates them into instances of your Class::Type::Enum classes. that's it, that's the flex. π₯
and here's the tea β the storage data_type does not matter here. literally doesn't care. the only thing that matters is whether your enums should inflate/deflate to symbols (aka strings) or to ordinals (aka integers). pick your fighter. π
π METHODS π
π¦ register_column($column, $info)
this method chains with "register_column" in DBIx::Class::Row, and it goes digging around inside the extra key of the column info looking for two little subkeys. two. exactly two. it's very specific about this. π
enum_classβ this one is Required to enable column inflation, so like, no skipping it bestie. you put in the complete class name that this column should be inflated to. and heads up: it should already be loaded, and it must be a subclass ofClass::Type::Enum. the vibes must be correct. πenum_ordinal_storageβ if this is true, then the column gets inflated from and deflated to ordinal values. simple as that, periodt. β¨
β SEE ALSO β
Class::Type::Enumβ the main character this whole module is obsessed with πDBIx::Class::InflateColumn::Object::Enumβ the other one, also valid, also serving π«Ά
π§ AUTHOR π§
Meredith Howard <mhoward@cpan.org> β absolute legend, give her flowers π
πΈ COPYRIGHT AND LICENSE πΈ
This software is copyright (c) 2018 by Meredith Howard.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. fr fr, free as in freedom, go wild. ποΈ
and that's the whole page bestie!! π this little number shipped as perl v5.32.1 on 2021-08-02, and she's still cute. mwah. πβ¨
π¦ where this page comes from
- debian bookworm: libclass-type-enum-perl 0.014-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libclass-type-enum-perl 0.014-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libclass-type-enum-perl 0.014-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libclass-type-enum-perl 0.014-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libclass-type-enum-perl 0.014-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libclass-type-enum-perl 0.014-2 Β· 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