line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Range::Compare::Stream::CallBack; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
33846
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
34
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
5
|
1
|
|
|
1
|
|
5
|
use base qw(Data::Range::Compare::Stream Exporter); |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
550
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
8
|
use constant NEW_FROM_CLASS=>'Data::Range::Compare::Stream::CallBack'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
59
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
5
|
use constant HELPER=>0; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
10
|
1
|
|
|
1
|
|
5
|
use constant RANGE_START =>1; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
35
|
|
11
|
1
|
|
|
1
|
|
4
|
use constant RANGE_END =>2; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
12
|
1
|
|
|
1
|
|
4
|
use constant RANGE_DATA =>3; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
68
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use overload |
15
|
1
|
|
|
|
|
15
|
'""'=>\&to_string, |
16
|
|
|
|
|
|
|
bool=>\&boolean, |
17
|
1
|
|
|
1
|
|
5
|
fallback=>1; |
|
1
|
|
|
|
|
1
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# global happy helper |
20
|
|
|
|
|
|
|
our %HELPER=( |
21
|
|
|
|
|
|
|
sub_one=>sub { $_[0] - 1 }, |
22
|
|
|
|
|
|
|
add_one=>sub { $_[0] + 1 }, |
23
|
|
|
|
|
|
|
cmp_values=>sub { $_[0] <=> $_[1] }, |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
our @EXPORT_OK=qw(%HELPER); |
27
|
|
|
|
|
|
|
|
28
|
14
|
|
|
14
|
1
|
7524
|
sub to_string { $_[0]->SUPER::to_string } |
29
|
|
|
|
|
|
|
|
30
|
1150
|
|
|
1150
|
0
|
5185
|
sub get_helper { $_[0]->[$_[0]->HELPER] } |
31
|
|
|
|
|
|
|
|
32
|
6
|
|
|
6
|
0
|
1395
|
sub boolean { $_[0]->SUPER::boolean } |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub new { |
35
|
137
|
|
|
137
|
1
|
2623
|
my ($class,@args)=@_; |
36
|
137
|
|
|
|
|
727
|
return bless [@args],$class; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub factory { |
40
|
128
|
|
|
128
|
1
|
261
|
my ($self,@args)=@_; |
41
|
128
|
|
|
|
|
383
|
my $new=$self->NEW_FROM_CLASS->new($self->get_helper,@args); |
42
|
128
|
|
|
|
|
414
|
return $new; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub sub_one { |
46
|
57
|
|
|
57
|
1
|
1102
|
my ($self,$value)=@_; |
47
|
57
|
|
|
|
|
131
|
return $self->get_helper->{sub_one}->($value); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub add_one { |
51
|
28
|
|
|
28
|
1
|
875
|
my ($self,$value)=@_; |
52
|
28
|
|
|
|
|
70
|
return $self->get_helper->{add_one}->($value); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub cmp_values { |
56
|
937
|
|
|
937
|
1
|
4553
|
my ($self,$value_a,$value_b)=@_; |
57
|
937
|
|
|
|
|
2024
|
return $self->get_helper->{cmp_values}->($value_a,$value_b); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |