| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package PHP::Serialization::XS; |
|
2
|
|
|
|
|
|
|
|
|
3
|
10
|
|
|
10
|
|
136193
|
use strict; |
|
|
10
|
|
|
|
|
29
|
|
|
|
10
|
|
|
|
|
283
|
|
|
4
|
10
|
|
|
10
|
|
51
|
use warnings; |
|
|
10
|
|
|
|
|
25
|
|
|
|
10
|
|
|
|
|
257
|
|
|
5
|
10
|
|
|
10
|
|
5052
|
use bytes; |
|
|
10
|
|
|
|
|
128
|
|
|
|
10
|
|
|
|
|
49
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
10
|
|
|
10
|
|
4296
|
use PHP::Serialization (); |
|
|
10
|
|
|
|
|
23007
|
|
|
|
10
|
|
|
|
|
2714
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
require Exporter; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @ISA = qw(PHP::Serialization Exporter); |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our %EXPORT_TAGS = (all => [ qw(serialize unserialize) ]); |
|
14
|
|
|
|
|
|
|
our @EXPORT_OK = @{ $EXPORT_TAGS{all} }; |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $VERSION = '0.10'; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
require XSLoader; |
|
19
|
|
|
|
|
|
|
XSLoader::load('PHP::Serialization::XS', $VERSION); |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $default = __PACKAGE__->new(prefer_array => 1); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub new |
|
24
|
|
|
|
|
|
|
{ |
|
25
|
14
|
|
|
14
|
0
|
62
|
my $class = shift; |
|
26
|
|
|
|
|
|
|
# depend on PHP::Serialize using a blessed hash |
|
27
|
14
|
|
|
|
|
59
|
my %args = @_; |
|
28
|
14
|
|
|
|
|
92
|
my $self = $class->SUPER::new(%args); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# precedence order was really undefined, but now we match legacy behaviour |
|
31
|
|
|
|
|
|
|
$self->{flags} = |
|
32
|
|
|
|
|
|
|
$args{prefer_hash} ? 0 : |
|
33
|
|
|
|
|
|
|
$args{prefer_undef} ? 2 : |
|
34
|
14
|
100
|
|
|
|
277
|
$args{prefer_array} ? 1 : |
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; # default is prefer_array |
|
36
|
|
|
|
|
|
|
|
|
37
|
14
|
|
|
|
|
45
|
return $self; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub unserialize |
|
41
|
|
|
|
|
|
|
{ |
|
42
|
6
|
|
|
6
|
1
|
2752
|
my ($str, $class) = @_; |
|
43
|
6
|
|
|
|
|
34
|
return $default->decode($str, $class); |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub serialize |
|
47
|
|
|
|
|
|
|
{ |
|
48
|
2
|
|
|
2
|
1
|
27
|
goto \&PHP::Serialization::serialize; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub decode |
|
52
|
|
|
|
|
|
|
{ |
|
53
|
19
|
|
|
19
|
1
|
2417
|
my ($self, $str, $class) = @_; |
|
54
|
19
|
100
|
|
|
|
70
|
$self = $default unless ref $self; |
|
55
|
19
|
|
50
|
|
|
499
|
return _c_decode($str || "", $self->{flags}, $class); |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# encode method is handled by super class |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
|
61
|
|
|
|
|
|
|
__END__ |