line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Argon::Marshal; |
2
|
|
|
|
|
|
|
# ABSTRACT: routines for serializing messages |
3
|
|
|
|
|
|
|
$Argon::Marshal::VERSION = '0.18'; |
4
|
|
|
|
|
|
|
|
5
|
4
|
|
|
4
|
|
273874
|
use strict; |
|
4
|
|
|
|
|
20
|
|
|
4
|
|
|
|
|
199
|
|
6
|
4
|
|
|
4
|
|
27
|
use warnings; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
138
|
|
7
|
4
|
|
|
4
|
|
26
|
use Carp; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
271
|
|
8
|
4
|
|
|
4
|
|
34
|
use Sereal::Decoder qw(sereal_decode_with_object); |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
305
|
|
9
|
4
|
|
|
4
|
|
30
|
use Sereal::Encoder qw(SRL_SNAPPY sereal_encode_with_object); |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
403
|
|
10
|
4
|
|
|
4
|
|
1609
|
use MIME::Base64 qw(encode_base64 decode_base64); |
|
4
|
|
|
|
|
3054
|
|
|
4
|
|
|
|
|
267
|
|
11
|
|
|
|
|
|
|
|
12
|
4
|
|
|
4
|
|
366
|
use parent 'Exporter'; |
|
4
|
|
|
|
|
373
|
|
|
4
|
|
|
|
|
28
|
|
13
|
|
|
|
|
|
|
our @EXPORT = qw(encode decode encode_msg decode_msg); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $ENC = Sereal::Encoder->new({compress => SRL_SNAPPY}); |
16
|
|
|
|
|
|
|
my $DEC = Sereal::Decoder->new(); |
17
|
|
|
|
|
|
|
|
18
|
21
|
|
|
21
|
0
|
850
|
sub encode { encode_base64(sereal_encode_with_object($ENC, $_[0]), '') } |
19
|
21
|
|
|
21
|
0
|
589
|
sub decode { sereal_decode_with_object($DEC, decode_base64($_[0])) } |
20
|
20
|
|
|
20
|
0
|
55
|
sub encode_msg { encode(\%{$_[0]}) } |
|
20
|
|
|
|
|
104
|
|
21
|
20
|
|
|
20
|
0
|
69
|
sub decode_msg { bless decode($_[0]), 'Argon::Message' } |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
1; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
__END__ |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=pod |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=encoding UTF-8 |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 NAME |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Argon::Marshal - routines for serializing messages |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 VERSION |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
version 0.18 |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 SYNOPSIS |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
use Argon::Marshal; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my $data = ['fnord']; |
44
|
|
|
|
|
|
|
my $encoded = encode($data); |
45
|
|
|
|
|
|
|
my $decoded = decode($encoded); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
my $msg = Argon::Message->new(...); |
48
|
|
|
|
|
|
|
my $encoded = encode_msg($msg); |
49
|
|
|
|
|
|
|
my $decoded = decode_msg($encoded); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 DESCRIPTION |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Provides routines to serialize and deserialize data and L<Argon::Message>s. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 AUTHOR |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Jeff Ober <sysread@fastmail.fm> |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Jeff Ober. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
64
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |