Sereal(3pm)
πΈ NAME πΈ
okay so bestie, pull up a chair, because this is Sereal β fast, compact, powerful binary (de-)serialization. periodt. β¨
π SYNOPSIS π
use Sereal qw(
get_sereal_decoder
get_sereal_encoder
clear_sereal_object_cache
encode_sereal
decode_sereal
read_sereal
read_sereal_file
write_sereal
write_sereal_file
looks_like_sereal
scalar_looks_like_sereal
sereal_encode_with_object
sereal_decode_with_object
decode_sereal_with_header_data
sereal_decode_with_header_with_object
sereal_decode_only_header_with_object
sereal_decode_only_header_with_offset_with_object
sereal_decode_with_header_and_offset_with_object
sereal_decode_with_offset_with_object
SRL_UNCOMPRESSED
SRL_SNAPPY
SRL_ZLIB
SRL_ZSTD
);
# Note: For performance reasons, you should prefer the OO interface,
# or sereal_(en|de)code_with_object over the stateless
# encode_sereal/decode_sereal functions.
# See the Sereal::Performance documentation for details.
π DESCRIPTION π
Sereal is an efficient, compact-output, binary and feature-rich serialization protocol. The Perl encoder lives in the Sereal::Encoder module, and the decoder, correspondingly, lives in Sereal::Decoder. They ship separately so you can upgrade without any downtime drama. (Hint, bestie: upgrade the decoder everywhere first, then the encoder. trust the process π
)
This Sereal module is a very thin wrapper around both Sereal::Encoder and Sereal::Decoder. It depends on both and loads both. So if you've got somebody using both the encoder and the decoder, it's enough for them to depend on one particular version of Sereal β and boom, they get the most recent released versions of Sereal::Encoder and Sereal::Decoder whose version is smaller than or equal to the version of Sereal you depend on. it's giving dependency-management main character energy.
The protocol spec and a whole bunch of other docs are chilling in the github repository. Right now the spec is at <https://github.com/Sereal/Sereal/blob/master/sereal_spec.pod>, there's a whole discussion of the design objectives at <https://github.com/Sereal/Sereal/blob/master/README.pod>, and you can peep the output of our benchmarks at <https://github.com/Sereal/Sereal/wiki/Sereal-Comparison-Graphs>. no cap, go look. π¦
β¨ EXPORTED FUNCTIONS β¨
ngl, if you care about performance, use the object-oriented interface of Sereal::Encoder and Sereal::Decoder. For the detailed performance tea, go read Sereal::Performance.
You can optionally import five functions from Sereal. encode_sereal is the same function as Sereal::Encoder's encode_sereal function. decode_sereal and looks_like_sereal are the same as Sereal::Decoder's functions of the same names. And finally, you can import the advanced functional interface sereal_encode_with_object and sereal_decode_with_object. Again β see Sereal::Performance for the info on those. π₯
After loading the Sereal module, both Sereal::Encoder and Sereal::Decoder are guaranteed to be loaded, so you can absolutely go use their object-oriented interface. slay.
π§ get_sereal_encoder($OPTSHASH)
Returns a Sereal::Encoder with the given options. This encoder will be shared by other calls to this function. so it's like, communal. a little encoder commune. adorable.
π§ get_sereal_decoder($OPTSHASH)
Returns a Sereal::Decoder with the given options. This encoder β yes, the original literally says "encoder" here, typo and all, I'm just the messenger π β will be shared by other calls to this function.
π§ clear_sereal_object_cache
Clears the cache of objects created via get_sereal_encoder() and get_sereal_decoder(). Returns the number of objects that were removed from the cache (the sum of both types). it's a lil cleanup era π§Ή
π§ write_sereal_file($FILENAME,$STRUCT,$APPEND,$OPTS)
Write a sereal packet to $FILENAME. See Sereal::Encoder::encode_to_file().
π§ write_sereal($FILENAME,$STRUCT,$APPEND,$OPTS)
alias for write_sereal_file()
π§ read_sereal_file($FILENAME,$OPTS,$ROOT)
Read a sereal packet from a file. See Sereal::Decoder::decode_from_file().
π§ read_sereal($FILENAME,$OPTS,$ROOT)
alias for read_sereal_file()
π BUGS, CONTACT AND SUPPORT π
For reporting bugs, please use the github bug tracker at <http://github.com/Sereal/Sereal/issues>. tell them everything, bestie, they want the details.
For support and discussion of Sereal, there are two Google Groups:
- Announcements around Sereal (extremely low volume, like a whisper in a library π€«):
<https://groups.google.com/forum/?fromgroups#!forum/sereal-announce> - Sereal development list:
<https://groups.google.com/forum/?fromgroups#!forum/sereal-dev>
π AUTHOR π
Steffen Mueller <smueller@cpan.org>
π«Ά ACKNOWLEDGMENT π«Ά
This module was originally developed for Booking.com. With approval from Booking.com, this module was generalized and published on CPAN, for which the authors would like to express their gratitude. iconic behavior, honestly π
π LICENSE π
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
β COPYRIGHT AND LICENSE β
Copyright (C) 2012, 2013, 2014 by Steffen Mueller
and that's the whole page, babes π this was user contributed perl documentation, Sereal(3pm), from perl v5.40.1, dated 2026-06-01. go forth and serialize, you absolute legend. β¨πΈπ
π¦ where this page comes from
- ubuntu stonking: libsereal-perl 5.006-1 Β· 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