line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
Text::CSV::Track::Min - same as Text::CSV::Track but stores the smallest value |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 VERSION |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
This documentation refers to version 0.3. |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
see L as this is inherited object from it. |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 DESCRIPTION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Only difference to Track is that before value is changed it is compared to the |
16
|
|
|
|
|
|
|
old one. It it's higher then the value is updated if not old value persists. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=cut |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
package Text::CSV::Track::Min; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our $VERSION = '0.3'; |
23
|
2
|
|
|
2
|
|
29378
|
use 5.006; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
102
|
|
24
|
|
|
|
|
|
|
|
25
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
96
|
|
26
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
96
|
|
27
|
|
|
|
|
|
|
|
28
|
2
|
|
|
2
|
|
17
|
use base qw(Text::CSV::Track); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1045
|
|
29
|
|
|
|
|
|
|
|
30
|
2
|
|
|
2
|
|
24
|
use FindBin; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
107
|
|
31
|
|
|
|
|
|
|
|
32
|
2
|
|
|
2
|
|
16
|
use Text::CSV_XS; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
85
|
|
33
|
2
|
|
|
2
|
|
20
|
use Carp::Clan; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
23
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 METHODS |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=over 4 |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=item value_of() |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Overridden function from L that stores value only if it is |
43
|
|
|
|
|
|
|
smaller then the one before. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub value_of { |
48
|
47
|
|
|
47
|
1
|
2429
|
my $self = shift; |
49
|
47
|
|
|
|
|
73
|
my $identificator = shift; |
50
|
47
|
100
|
|
|
|
105
|
my $is_set = (@_ > 0 ? 1 : 0); #get or set request depending on number of arguments |
51
|
47
|
|
|
|
|
277
|
my $value = shift; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
#variables from self hash |
54
|
47
|
|
|
|
|
198
|
my $rh_value_of = $self->_rh_value_of; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
#check if we have identificator |
57
|
47
|
50
|
|
|
|
246
|
return if not $identificator; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
#if get call super value_of |
60
|
47
|
100
|
|
|
|
317
|
return $self->SUPER::value_of($identificator) if not $is_set; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
#set |
63
|
24
|
|
|
|
|
23
|
my $old_value; |
64
|
24
|
100
|
|
|
|
57
|
if (exists $rh_value_of->{$identificator}) { #don't call SUPER::value_of because it will active lazy init that is may be not necessary |
65
|
7
|
|
|
|
|
9
|
$old_value = ${$rh_value_of->{$identificator}}[0]; |
|
7
|
|
|
|
|
17
|
|
66
|
|
|
|
|
|
|
} |
67
|
24
|
100
|
100
|
|
|
275
|
if (not defined $value |
|
|
|
100
|
|
|
|
|
68
|
|
|
|
|
|
|
or not defined $old_value |
69
|
|
|
|
|
|
|
or ($old_value > $value) |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
) { #if it is removel or the old value is smaller then set it |
72
|
20
|
|
|
|
|
102
|
$self->SUPER::value_of($identificator, $value); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=back |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=cut |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |
81
|
|
|
|
|
|
|
|