line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PHP::Serialization::XS; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
42551
|
use strict; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
160
|
|
4
|
6
|
|
|
6
|
|
21
|
use warnings; |
|
6
|
|
|
|
|
4
|
|
|
6
|
|
|
|
|
106
|
|
5
|
6
|
|
|
6
|
|
2777
|
use bytes; |
|
6
|
|
|
|
|
45
|
|
|
6
|
|
|
|
|
20
|
|
6
|
|
|
|
|
|
|
|
7
|
6
|
|
|
6
|
|
3092
|
use PHP::Serialization (); |
|
6
|
|
|
|
|
12190
|
|
|
6
|
|
|
|
|
1244
|
|
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.07'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our %DEFAULT_OPTS = ( |
19
|
|
|
|
|
|
|
prefer_hash => 0, |
20
|
|
|
|
|
|
|
prefer_array => 1, |
21
|
|
|
|
|
|
|
prefer_undef => 0, |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
require XSLoader; |
25
|
|
|
|
|
|
|
XSLoader::load('PHP::Serialization::XS', $VERSION); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# in XS |
28
|
|
|
|
|
|
|
sub new; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub unserialize |
31
|
|
|
|
|
|
|
{ |
32
|
4
|
|
|
4
|
1
|
332
|
my ($str, $class) = @_; |
33
|
4
|
|
|
|
|
263
|
return __PACKAGE__->new(%DEFAULT_OPTS)->decode($str, $class); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub serialize |
37
|
|
|
|
|
|
|
{ |
38
|
2
|
|
|
2
|
1
|
27
|
goto \&PHP::Serialization::serialize; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub decode |
42
|
|
|
|
|
|
|
{ |
43
|
4
|
|
|
4
|
1
|
49
|
my ($self, $str, $class) = @_; |
44
|
4
|
50
|
|
|
|
15
|
$self = $self->new(%DEFAULT_OPTS) unless ref $self; |
45
|
4
|
|
50
|
|
|
128
|
return $self->_c_decode($str || "", $class); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub encode |
49
|
|
|
|
|
|
|
{ |
50
|
0
|
|
|
0
|
1
|
|
my ($self, @rest) = @_; |
51
|
0
|
|
|
|
|
|
my $parent = $self->_get_parent; |
52
|
0
|
|
|
|
|
|
return $parent->encode(@rest); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |
56
|
|
|
|
|
|
|
__END__ |