| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Data::MessagePack; |
|
2
|
50
|
|
|
50
|
|
2137302
|
use strict; |
|
|
50
|
|
|
|
|
485
|
|
|
|
50
|
|
|
|
|
1514
|
|
|
3
|
50
|
|
|
50
|
|
268
|
use warnings; |
|
|
50
|
|
|
|
|
96
|
|
|
|
50
|
|
|
|
|
1250
|
|
|
4
|
50
|
|
|
50
|
|
1231
|
use 5.008001; |
|
|
50
|
|
|
|
|
175
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '1.01'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub true () { |
|
9
|
140
|
|
|
140
|
0
|
138033
|
require Data::MessagePack::Boolean; |
|
10
|
50
|
|
|
50
|
|
387
|
no warnings 'once'; |
|
|
50
|
|
|
|
|
124
|
|
|
|
50
|
|
|
|
|
3803
|
|
|
11
|
140
|
|
|
|
|
986
|
return $Data::MessagePack::Boolean::true; |
|
12
|
|
|
|
|
|
|
} |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub false () { |
|
15
|
172
|
|
|
172
|
0
|
16688
|
require Data::MessagePack::Boolean; |
|
16
|
50
|
|
|
50
|
|
347
|
no warnings 'once'; |
|
|
50
|
|
|
|
|
110
|
|
|
|
50
|
|
|
|
|
16919
|
|
|
17
|
172
|
|
|
|
|
768
|
return $Data::MessagePack::Boolean::false; |
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
if ( !__PACKAGE__->can('pack') ) { # this idea comes from Text::Xslate |
|
21
|
|
|
|
|
|
|
my $backend = $ENV{PERL_DATA_MESSAGEPACK} || ($ENV{PERL_ONLY} ? 'pp' : ''); |
|
22
|
|
|
|
|
|
|
if ( $backend !~ /\b pp \b/xms ) { |
|
23
|
|
|
|
|
|
|
eval { |
|
24
|
|
|
|
|
|
|
require XSLoader; |
|
25
|
|
|
|
|
|
|
XSLoader::load(__PACKAGE__, $VERSION); |
|
26
|
|
|
|
|
|
|
}; |
|
27
|
|
|
|
|
|
|
die $@ if $@ && $backend =~ /\b xs \b/xms; # force XS |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
if ( !__PACKAGE__->can('pack') ) { |
|
30
|
|
|
|
|
|
|
require 'Data/MessagePack/PP.pm'; |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub new { |
|
35
|
295
|
|
|
295
|
1
|
72749
|
my($class, %args) = @_; |
|
36
|
295
|
|
|
|
|
949
|
return bless \%args, $class; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
foreach my $name(qw(canonical prefer_integer utf8)) { |
|
40
|
|
|
|
|
|
|
my $setter = sub { |
|
41
|
60
|
|
|
60
|
|
1008
|
my($self, $value) = @_; |
|
42
|
60
|
100
|
|
|
|
186
|
$self->{$name} = defined($value) ? $value : 1; |
|
43
|
60
|
|
|
|
|
252
|
return $self; |
|
44
|
|
|
|
|
|
|
}; |
|
45
|
|
|
|
|
|
|
my $getter = sub { |
|
46
|
8
|
|
|
8
|
|
25
|
my($self) = @_; |
|
47
|
8
|
|
|
|
|
35
|
return $self->{$name}; |
|
48
|
|
|
|
|
|
|
}; |
|
49
|
50
|
|
|
50
|
|
453
|
no strict 'refs'; |
|
|
50
|
|
|
|
|
124
|
|
|
|
50
|
|
|
|
|
5876
|
|
|
50
|
|
|
|
|
|
|
*{$name} = $setter; |
|
51
|
|
|
|
|
|
|
*{'get_' . $name} = $getter; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub encode; *encode = __PACKAGE__->can('pack'); |
|
56
|
|
|
|
|
|
|
sub decode; *decode = __PACKAGE__->can('unpack'); |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
|
59
|
|
|
|
|
|
|
__END__ |