Jifty:...::YAML(3pm)
π Jifty::DBI::Filter::YAML π
okay bestie so this is Jifty:...::YAML(3pm), from the User Contributed Perl Documentation collection, and it's literally the filter that lets you shove any Perl data into a database column as YAML. yes, really. slay.
β¨ NAME β¨
Jifty::DBI::Filter::YAML β this filter stores arbitrary Perl via YAML π
π¦ SYNOPSIS π¦
like, here's the whole vibe:
use Jifty::DBI::Record schema {
column my_data =>
type is 'text',
filters are qw/ Jifty::DBI::Filter::YAML /;
};
my $thing = __PACKAGE__->new;
$thing->create( my_data => { foo => 'bar', baz => [ 1, 2, 3 ] } );
my $my_data = $thing->my_data;
while (my ($key, $value) = %$my_data) {
# do something...
}
look at that. a whole hash, with an array inside it, just vibing in a text column. no cap. π
πΈ DESCRIPTION πΈ
so the way this works is β this filter gives you the ability to store arbitrary data structures into a database column using YAML. it's giving very much the same energy as the Jifty::DBI::Filter::Storable filter, EXCEPT (and this is the iconic part) the YAML format stays human-readable in the database. so you can actually open it up and read it with your eyeballs instead of crying at binary. πβ¨
you can store virtually any Perl data into the database with this filter β scalar, hash, array, or object. all of it. periodt.
and bestie, there's more: YAML (at least the storage of scalars, hashes, and arrays) is compatible with data structures written in other languages, so you may store or read data between applications written in different languages. multilingual queen behavior. π
π METHODS π
π encode
this method is used to encode the Perl data structure into YAML formatted text.
π decode
this method is used to decode the YAML formatted text from the database into the Perl data structure.
π§ IMPLEMENTATION π§
so this class will attempt to use YAML::Syck if it is available, and then fall back upon YAML. why, you ask? because the Syck library is written in C and is considerably faster. speed demon energy. π₯
π SEE ALSO π
Jifty::DBI::FilterYAMLYAML::Syck
π«Ά AUTHOR π«Ά
Andrew Sterling Hanenkamp <hanenkamp@cpan.org> β thank you for your service, king π
π LICENSE π
This program is free software and may be modified or distributed under the same terms as Perl itself.
fr fr, go forth and YAML-ify your data. just remember: human-readable in the database, iconic in the group chat. π
perl v5.34.0 Β· 2022-06-15 β that's the version and the date this lil page was born, and honestly? it still ate. bye bestie, go store some arbitrary data structures π πβ¨
π¦ where this page comes from
- debian bookworm: libjifty-dbi-perl 0.78-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libjifty-dbi-perl 0.78-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libjifty-dbi-perl 0.78-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libjifty-dbi-perl 0.78-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libjifty-dbi-perl 0.78-3 Β· 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