1Sereal(3) User Contributed Perl Documentation Sereal(3)
2
3
4
6 Sereal - Fast, compact, powerful binary (de-)serialization
7
9 use Sereal qw(
10 get_sereal_decoder
11 get_sereal_encoder
12 clear_sereal_object_cache
13
14 encode_sereal
15 decode_sereal
16
17 read_sereal
18 read_sereal_file
19 write_sereal
20 write_sereal_file
21
22 looks_like_sereal
23 scalar_looks_like_sereal
24
25 sereal_encode_with_object
26 sereal_decode_with_object
27 decode_sereal_with_header_data
28
29 sereal_decode_with_header_with_object
30 sereal_decode_only_header_with_object
31 sereal_decode_only_header_with_offset_with_object
32 sereal_decode_with_header_and_offset_with_object
33 sereal_decode_with_offset_with_object
34
35 SRL_UNCOMPRESSED
36 SRL_SNAPPY
37 SRL_ZLIB
38 SRL_ZSTD
39 );
40 # Note: For performance reasons, you should prefer the OO interface,
41 # or sereal_(en|de)code_with_object over the stateless
42 # encode_sereal/decode_sereal functions.
43 # See the Sereal::Performance documentation for details.
44
46 Sereal is an efficient, compact-output, binary and feature-rich
47 serialization protocol. The Perl encoder is implemented as the
48 Sereal::Encoder module, the Perl decoder correspondingly as
49 Sereal::Decoder. They are distributed separately to allow for safe
50 upgrading without downtime. (Hint: Upgrade the decoder everywhere
51 first, then the encoder.)
52
53 This "Sereal" module is a very thin wrapper around both
54 "Sereal::Encoder" and "Sereal::Decoder". It depends on both and loads
55 both. So if you have a user of both encoder and decoder, it is enough
56 to depend on a particular version of "Sereal" and you'll get the most
57 recent released versions of "Sereal::Encoder" and "Sereal::Decoder"
58 whose version is smaller than or equal to the version of "Sereal" you
59 depend on.
60
61 The protocol specification and many other bits of documentation can be
62 found in the github repository. Right now, the specification is at
63 <https://github.com/Sereal/Sereal/blob/master/sereal_spec.pod>, there
64 is a discussion of the design objectives in
65 <https://github.com/Sereal/Sereal/blob/master/README.pod>, and the
66 output of our benchmarks can be seen at
67 <https://github.com/Sereal/Sereal/wiki/Sereal-Comparison-Graphs>.
68
69 EXPORTED FUNCTIONS
70 It is recommended to use the object-oriented interface of
71 "Sereal::Encoder" and "Sereal::Decoder" if you care about performance.
72 For detailed performance considerations, see Sereal::Performance.
73
74 You can optionally import five functions from "Sereal".
75 "encode_sereal" is the same function as Sereal::Encoder's
76 "encode_sereal" function. "decode_sereal" and "looks_like_sereal" are
77 the same as Sereal::Decoder's functions of the same names. Finally,
78 you can import the advanced functional interface
79 "sereal_encode_with_object" and "sereal_decode_with_object". Again,
80 see Sereal::Performance for information about those.
81
82 After loading the "Sereal" module, both "Sereal::Encoder" and
83 "Sereal::Decoder" are guaranteed to be loaded, so you can use their
84 object-oriented interface.
85
86 get_sereal_encoder($OPTSHASH)
87 Returns a Sereal::Encoder with the given options. This encoder will be
88 shared by other calls to this function.
89
90 get_sereal_decoder($OPTSHASH)
91 Returns a Sereal::Decoder with the given options. This encoder will be
92 shared by other calls to this function.
93
94 clear_sereal_object_cache
95 Clears cache of objects created via get_sereal_encoder() and
96 get_sereal_decoder(). Returns the number of objects that were removed
97 from the cache (the sum of both types).
98
99 write_sereal_file($FILENAME,$STRUCT,$APPEND,$OPTS)
100 Write a sereal packet to $FILENAME. See
101 Sereal::Encoder::encode_to_file().
102
103 write_sereal($FILENAME,$STRUCT,$APPEND,$OPTS)
104 alias for write_sereal_file()
105
106 read_sereal_file($FILENAME,$OPTS,$ROOT)
107 Read a sereal packet from a file. See
108 Sereal::Decoder::decode_from_file().
109
110 read_sereal($FILENAME,$OPTS,$ROOT)
111 alias for read_sereal_file()
112
114 For reporting bugs, please use the github bug tracker at
115 <http://github.com/Sereal/Sereal/issues>.
116
117 For support and discussion of Sereal, there are two Google Groups:
118
119 Announcements around Sereal (extremely low volume):
120 <https://groups.google.com/forum/?fromgroups#!forum/sereal-announce>
121
122 Sereal development list:
123 <https://groups.google.com/forum/?fromgroups#!forum/sereal-dev>
124
126 Steffen Mueller <smueller@cpan.org>
127
129 This module was originally developed for Booking.com. With approval
130 from Booking.com, this module was generalized and published on CPAN,
131 for which the authors would like to express their gratitude.
132
134 This library is free software; you can redistribute it and/or modify it
135 under the same terms as Perl itself.
136
138 Copyright (C) 2012, 2013, 2014 by Steffen Mueller
139
140
141
142perl v5.30.1 2020-02-04 Sereal(3)