line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PHP::Serialization::XS; |
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
112935
|
use strict; |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
283
|
|
4
|
8
|
|
|
8
|
|
44
|
use warnings; |
|
8
|
|
|
|
|
12
|
|
|
8
|
|
|
|
|
415
|
|
5
|
8
|
|
|
8
|
|
4843
|
use bytes; |
|
8
|
|
|
|
|
75
|
|
|
8
|
|
|
|
|
41
|
|
6
|
|
|
|
|
|
|
|
7
|
8
|
|
|
8
|
|
5211
|
use PHP::Serialization (); |
|
8
|
|
|
|
|
23208
|
|
|
8
|
|
|
|
|
2450
|
|
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.08'; |
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
|
6
|
|
|
6
|
1
|
1557
|
my ($str, $class) = @_; |
33
|
6
|
|
|
|
|
515
|
return __PACKAGE__->new(%DEFAULT_OPTS)->decode($str, $class); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub serialize |
37
|
|
|
|
|
|
|
{ |
38
|
2
|
|
|
2
|
1
|
32
|
goto \&PHP::Serialization::serialize; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub decode |
42
|
|
|
|
|
|
|
{ |
43
|
15
|
|
|
15
|
1
|
1826
|
my ($self, $str, $class) = @_; |
44
|
15
|
100
|
|
|
|
456
|
$self = $self->new(%DEFAULT_OPTS) unless ref $self; |
45
|
15
|
|
50
|
|
|
436
|
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__ |