| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# Directly copied from Lemonldap::NG project (http://lemonldap-ng.org/) |
|
2
|
|
|
|
|
|
|
package Apache::Session::Serialize::JSON; |
|
3
|
|
|
|
|
|
|
|
|
4
|
5
|
|
|
5
|
|
41
|
use strict; |
|
|
5
|
|
|
|
|
44
|
|
|
|
5
|
|
|
|
|
176
|
|
|
5
|
5
|
|
|
5
|
|
4053
|
use JSON qw(to_json from_json); |
|
|
5
|
|
|
|
|
43036
|
|
|
|
5
|
|
|
|
|
26
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '1.2.6'; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub serialize { |
|
10
|
114
|
|
|
114
|
0
|
24553
|
my $session = shift; |
|
11
|
|
|
|
|
|
|
|
|
12
|
114
|
|
|
|
|
547
|
$session->{serialized} = to_json( $session->{data}, { allow_nonref => 1 } ); |
|
13
|
|
|
|
|
|
|
} |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub unserialize { |
|
16
|
148
|
|
|
148
|
0
|
353
|
my ( $session, $next ) = @_; |
|
17
|
|
|
|
|
|
|
|
|
18
|
148
|
|
|
|
|
348
|
my $data = _unserialize( $session->{serialized}, $next ); |
|
19
|
148
|
50
|
|
|
|
341
|
die "Session could not be unserialized" unless defined $data; |
|
20
|
148
|
|
|
|
|
389
|
$session->{data} = $data; |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub _unserialize { |
|
24
|
456
|
|
|
456
|
|
971
|
my ( $serialized, $next ) = @_; |
|
25
|
456
|
|
|
|
|
722
|
my $tmp; |
|
26
|
456
|
|
|
|
|
1115
|
eval { $tmp = from_json( $serialized, { allow_nonref => 1 } ) }; |
|
|
456
|
|
|
|
|
1577
|
|
|
27
|
456
|
50
|
|
|
|
11928
|
if ($@) { |
|
28
|
0
|
|
|
|
|
0
|
require Storable; |
|
29
|
0
|
|
0
|
|
|
0
|
$next ||= \&Storable::thaw; |
|
30
|
0
|
|
|
|
|
0
|
return &$next($serialized); |
|
31
|
|
|
|
|
|
|
} |
|
32
|
456
|
|
|
|
|
7420
|
return $tmp; |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=pod |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 NAME |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=encoding utf8 |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Apache::Session::Serialize::JSON - Use JSON to zip up data |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
use Apache::Session::Serialize::JSON; |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
$zipped = Apache::Session::Serialize::JSON::serialize($ref); |
|
50
|
|
|
|
|
|
|
$ref = Apache::Session::Serialize::JSON::unserialize($zipped); |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
This module fulfills the serialization interface of Apache::Session. |
|
55
|
|
|
|
|
|
|
It serializes the data in the session object by use of JSON C |
|
56
|
|
|
|
|
|
|
and C. The serialized data is UTF-8 text. |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
L, L |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 AUTHORS |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=over |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=item Clement Oudot, Eclem.oudot@gmail.comE |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=item François-Xavier Deltombe, Efxdeltombe@gmail.com.E |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item Xavier Guimard, Ex.guimard@free.frE |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=item Thomas Chemineau, Ethomas.chemineau@gmail.comE |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=back |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 BUG REPORT |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Use OW2 system to report bug or ask for features: |
|
80
|
|
|
|
|
|
|
L |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=over |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=item Copyright (C) 2015-2017 by Clément Oudot, Eclem.oudot@gmail.comE |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=item Copyright (C) 2015-2017 by Xavier Guimard, Ex.guimard@free.frE |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=back |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
|
93
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
|
94
|
|
|
|
|
|
|
the Free Software Foundation; either version 2, or (at your option) |
|
95
|
|
|
|
|
|
|
any later version. |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, |
|
98
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
99
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
100
|
|
|
|
|
|
|
GNU General Public License for more details. |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License |
|
103
|
|
|
|
|
|
|
along with this program. If not, see L. |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=cut |