line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Math::Histogram; |
2
|
7
|
|
|
7
|
|
4896
|
use 5.008001; |
|
7
|
|
|
|
|
22
|
|
|
7
|
|
|
|
|
279
|
|
3
|
7
|
|
|
7
|
|
34
|
use strict; |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
195
|
|
4
|
7
|
|
|
7
|
|
43
|
use warnings; |
|
7
|
|
|
|
|
8
|
|
|
7
|
|
|
|
|
201
|
|
5
|
7
|
|
|
7
|
|
38
|
use Carp qw(croak); |
|
7
|
|
|
|
|
11
|
|
|
7
|
|
|
|
|
506
|
|
6
|
7
|
|
|
7
|
|
32762
|
use JSON::XS (); |
|
7
|
|
|
|
|
112970
|
|
|
7
|
|
|
|
|
4598
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '1.03'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
require XSLoader; |
11
|
|
|
|
|
|
|
XSLoader::load('Math::Histogram', $VERSION); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
require Math::Histogram::Axis; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
require Exporter; |
16
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
17
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
18
|
|
|
|
|
|
|
make_histogram |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
22
|
|
|
|
|
|
|
'all' => \@EXPORT_OK, |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub make_histogram { |
26
|
10
|
|
|
10
|
0
|
1203752
|
my @axises = map Math::Histogram::Axis->new(@$_), @_; |
27
|
10
|
|
|
|
|
360
|
return Math::Histogram->new(\@axises); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub _from_hash { |
31
|
3
|
|
|
3
|
|
1134
|
my ($class, $hashref) = @_; |
32
|
3
|
|
|
|
|
7
|
my $axises_in = $hashref->{axises}; |
33
|
3
|
50
|
|
|
|
15
|
if (not ref($axises_in) eq 'ARRAY') { |
34
|
0
|
|
|
|
|
0
|
croak("Need 'axises' hash element as an array reference"); |
35
|
|
|
|
|
|
|
} |
36
|
3
|
|
|
|
|
9
|
my $axises = []; |
37
|
3
|
|
|
|
|
57
|
push @$axises, Math::Histogram::Axis->_from_hash($_) for @$axises_in; |
38
|
3
|
|
|
|
|
262
|
return $class->_from_hash_internal($hashref, $axises); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub serialize { |
42
|
1
|
|
|
1
|
1
|
78529
|
my $self = shift; |
43
|
1
|
|
|
|
|
92
|
my $hash = $self->_as_hash; |
44
|
1
|
|
|
|
|
536
|
return JSON::XS::encode_json($hash); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub deserialize { |
48
|
2
|
|
|
2
|
1
|
321
|
my $class = shift; |
49
|
2
|
100
|
|
|
|
107
|
my $hash = JSON::XS::decode_json(ref($_[0]) ? ${$_[0]} : $_[0]); |
|
1
|
|
|
|
|
72
|
|
50
|
2
|
|
|
|
|
11
|
return $class->_from_hash($hash); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
__END__ |