MooseX...eferred(3pm)
πΈ MooseX::Storage::Deferred π
okay so bestie, you're reading a page from the User Contributed Perl Documentation, and it's all about MooseX::Storage::Deferred β currently sitting at version 0.53 β¨. Let's get into it, no cap.
β¨ NAME
MooseX::Storage::Deferred β a role for indecisive programmers π¦ (and honestly? relatable, because who wants to commit to a serialization format at class-definition time)
π VERSION
version 0.53 β
π SYNOPSIS
package Point;
use Moose;
use MooseX::Storage;
with 'MooseX::Storage::Deferred';
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({ format => 'JSON' }); # { "__CLASS__" : "Point", "x" : 10, "y" : 10 }
# pack the class into a JSON string using parameterized JSONpm role
$p->freeze({ format => [ JSONpm => { json_opts => { pretty => 1 } } ] });
# unpack the JSON string into a class
my $p2 = Point->thaw(
'{ "__CLASS__" : "Point", "x" : 10, "y" : 10 }',
{ format => 'JSON' }
);
likeβ¦ you literally decide the format at call time and not one second before?? iconic behavior honestly π«Ά
π DESCRIPTION
So this role exists for those moments when you need to serialize into a whole bunch of different formats, or a bunch of different I/O options, and you wanna keep your options open π«
Basically? It lets you pick the format and the I/O options only at the exact moment you actually use them. Not before, not after. At use time. Periodt. (peep the SYNOPSIS above if you want the receipts π)
π SUPPORTED FORMATS
JSONJSONpmYAMLStorable
π¦ SUPPORTED I/O
FileAtomicFile
β οΈ NOTE: TheStorableFileI/O option is not supported, and here's the tea β it's because it does not mix well with options who also have a"thaw"and"freeze"methods like this one π. It is possible to probably work around this issue, but the author doesn't currently have the need for it. If you do need this supported, talk to them and they will see what they can do π¬
π METHODS
freeze ($type_desc)thaw ($data, $type_desc)load ($filename, $type_desc)store ($filename, $type_desc)
π SUPPORT
Bugs may be submitted through the RT bug tracker <https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-Storage> (or to <mailto:bug-MooseX-Storage@rt.cpan.org>) β¨
There is also a mailing list available for users of this distribution, at <http://lists.perl.org/list/moose.html> π
There is also an irc channel available for users of this distribution, at "#moose" on "irc.perl.org" <irc://irc.perl.org/#moose> π₯
π AUTHORS
- 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 πΈ
and that's the whole page bestie, we ate π½οΈπ sign-off time: this doc came from perl v5.36.0 and it's dated 2022-10-16 β go forth and defer your formats, main character πβ¨
π¦ 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