line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Math::Histogram; |
2
|
7
|
|
|
7
|
|
3128
|
use 5.008001; |
|
7
|
|
|
|
|
17
|
|
|
7
|
|
|
|
|
214
|
|
3
|
7
|
|
|
7
|
|
23
|
use strict; |
|
7
|
|
|
|
|
9
|
|
|
7
|
|
|
|
|
178
|
|
4
|
7
|
|
|
7
|
|
31
|
use warnings; |
|
7
|
|
|
|
|
7
|
|
|
7
|
|
|
|
|
193
|
|
5
|
7
|
|
|
7
|
|
26
|
use Carp qw(croak); |
|
7
|
|
|
|
|
10
|
|
|
7
|
|
|
|
|
365
|
|
6
|
7
|
|
|
7
|
|
3982
|
use JSON::XS (); |
|
7
|
|
|
|
|
57348
|
|
|
7
|
|
|
|
|
3075
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '1.04'; |
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
|
850842
|
my @axises = map Math::Histogram::Axis->new(@$_), @_; |
27
|
10
|
|
|
|
|
212
|
return Math::Histogram->new(\@axises); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub _from_hash { |
31
|
3
|
|
|
3
|
|
591
|
my ($class, $hashref) = @_; |
32
|
3
|
|
|
|
|
5
|
my $axises_in = $hashref->{axises}; |
33
|
3
|
50
|
|
|
|
11
|
if (not ref($axises_in) eq 'ARRAY') { |
34
|
0
|
|
|
|
|
0
|
croak("Need 'axises' hash element as an array reference"); |
35
|
|
|
|
|
|
|
} |
36
|
3
|
|
|
|
|
4
|
my $axises = []; |
37
|
3
|
|
|
|
|
38
|
push @$axises, Math::Histogram::Axis->_from_hash($_) for @$axises_in; |
38
|
3
|
|
|
|
|
192
|
return $class->_from_hash_internal($hashref, $axises); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub serialize { |
42
|
1
|
|
|
1
|
1
|
66979
|
my $self = shift; |
43
|
1
|
|
|
|
|
53
|
my $hash = $self->_as_hash; |
44
|
1
|
|
|
|
|
336
|
return JSON::XS::encode_json($hash); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub deserialize { |
48
|
2
|
|
|
2
|
1
|
392
|
my $class = shift; |
49
|
2
|
100
|
|
|
|
79
|
my $hash = JSON::XS::decode_json(ref($_[0]) ? ${$_[0]} : $_[0]); |
|
1
|
|
|
|
|
60
|
|
50
|
2
|
|
|
|
|
7
|
return $class->_from_hash($hash); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
__END__ |