Tangra...p::Perl(3pm)
β¨ Tangram::Type::Dump::Perl β¨
okay bestie, pull up a chair π«Ά this is the Tangram::Type::Dump::Perl page from the User Contributed Perl Documentation, and it's literally about mapping any Perl object as a scalar dump. yes, any. no cap.
πΈ NAME πΈ
Tangram::Type::Dump::Perl β map any Perl object as scalar dump π
π SYNOPSIS π
use Tangram::Core;
use Tangram::Type::Dump::Perl; # always
$schema = Tangram::Schema->new(
classes => { NaturalPerson => { fields => {
perl_dump =>
{
diary => # diary is a perl hash
{
col => 'diarydata',
sql => 'TEXT',
indent => 0,
terse => 1,
purity => 0
},
lucky_numbers => 'int', # use defaults
}
β οΈ note the# alwaysnext to thatuseβ yeah, this one's not optional, she's mandatory β¨
π¦ DESCRIPTION π¦
So what does she do? She maps arbitrary Perl data structures by serializing them into a string representation. Iconic behavior honestly. π
The persistent fields get grouped into a hash under the perl_dump key in the field hash. That's the vibe.
Serialization is handled by Data::Dumper β she traverses the Perl data structure and builds a string representation out of it. That resulting string then gets mapped to the DBMS as a scalar value. And during restore? The scalar value gets eval'd to reconstruct the original data structure. the way that it round-tripsβ¦ obsessed π
As of Tangram 2.07.1, persistent references are safely handled via the Tangram::Type::Dump utility class. safe!! handled!! we love to see it π«Ά
The field names are passed in a hash that associates a field name with a field descriptor. The field descriptor can be either a hash or a string. The hash uses the following fields:
colsqlindenttersepurity
π the optional bits π
The optional fields col and sql specify the column name and the column type for the scalar value in the database. If they're not present, col defaults to the field name, and sql defaults to VARCHAR(255). And bestie, values will always be quoted as they are passed to the database β no exceptions, periodt. π
The remaining optional fields control the serialization process. They get passed down to Data::Dumper as values for the corresponding Data::Dumper options. Default settings are:
- no indentation (
indent=0) - compact format (
terse=1) - quick dump (
purity=0)
likeβ¦ defaults are giving low-effort-but-correct and honestly? valid π
π AUTHOR π
This mapping was contributed by Gabor Herr <herr@iti.informatik.tu-darmstadt.de> β thank you for your service, king π«‘π
and that's the page, bestie!! this was perl v5.36.0, dated 2022-10-16, from the Tangra...p::Perl(3pm) manual π go serialize something unhinged, ily, bye!! β¨π¦πΈ
π¦ where this page comes from
- ubuntu noble: libtangram-perl 2.12-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtangram-perl 2.12-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtangram-perl 2.12-4 Β· 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