MooseX...t::JSON(3pm)
π MooseX::Storage::Format::JSON β a JSON serialization role π
okay bestie, so this is a page from the User Contributed Perl Documentation for MooseX...t::JSON (that's MooseX::Storage::Format::JSON if we're being formal, which we are, sometimes). It's a role. It does JSON. It's giving "I serialize your objects and I do it flawlessly." β¨
πΈ NAME πΈ
MooseX::Storage::Format::JSON β a JSON serialization role, no cap π
π VERSION π
version 0.53 β that's the one, that's the moment π
π¦ SYNOPSIS π¦
okay so watch this, we're gonna make a whole Point class and give it JSON storage powers with literally two extra lines:
package Point;
use Moose;
use MooseX::Storage;
with Storage('format' => 'JSON');
has 'x' => (is => 'rw', isa => 'Int');
has 'y' => (is => 'rw', isa => 'Int');
1;
my $p = Point->new(x => 10, y => 10);
## methods to freeze/thaw into
## a specified serialization format
## (in this case JSON)
# pack the class into a JSON string
$p->freeze(); # { "__CLASS__" : "Point", "x" : 10, "y" : 10 }
# unpack the JSON string into a class
my $p2 = Point->thaw('{ "__CLASS__" : "Point", "x" : 10, "y" : 10 }');
look at her. Point->new(x => 10, y => 10) and then freeze just hands you back a whole JSON string with the class name baked in as "__CLASS__". iconic. and thaw takes that string and resurrects the object like nothing ever happened. main character energy fr fr π«Ά
π METHODS π
freeze π
packs the class into a JSON string. that's the whole job, she does it gorgeously.
thaw ($json) π
takes that JSON string (the $json argument right there, don't forget her) and unpacks it back into a class. reverse uno card, but make it serialization.
π SUPPORT π
got beef? found a bug? bestie, they wanna hear about it π
- Bugs may be submitted through the RT bug tracker at <https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-Storage> (or you can email
bug-MooseX-Storage@rt.cpan.orgif email is more your vibe). - There is also a mailing list available for users of this distribution, right here: <http://lists.perl.org/list/moose.html>. join the chat, it's cute.
- There is also an irc channel available for users of this distribution, at
"#moose"on"irc.perl.org"β that's <irc://irc.perl.org/#moose>, come hang out π¬
π§ AUTHORS π§
the legends themselves, give them their flowers πΈ
- Chris Prather
<chris.prather@iinteractive.com> - Stevan Little
<stevan.little@iinteractive.com> - ΧΧΧΧ Χ§ΧΧ'ΧΧ (Yuval Kogman)
<nothingmuch@woobling.org>
β COPYRIGHT AND LICENSE β
This software is copyright (c) 2007 by Infinity Interactive, Inc.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. periodt π
and that's the whole page, bestie. this little icon was rendered by perl v5.36.0 and dated 2022-10-16, and it lives its life under the manual name MooseX...t::JSON(3pm). obsessed with her, honestly π¦β¨π
π¦ where this page comes from
- ubuntu noble: libmoosex-storage-perl 0.53-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libmoosex-storage-perl 0.53-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libmoosex-storage-perl 0.53-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