| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Time::List::Rows::Row; |
|
2
|
7
|
|
|
7
|
|
122
|
use 5.008_001; |
|
|
7
|
|
|
|
|
21
|
|
|
|
7
|
|
|
|
|
229
|
|
|
3
|
7
|
|
|
7
|
|
31
|
use strict; |
|
|
7
|
|
|
|
|
12
|
|
|
|
7
|
|
|
|
|
167
|
|
|
4
|
7
|
|
|
7
|
|
36
|
use warnings; |
|
|
7
|
|
|
|
|
17
|
|
|
|
7
|
|
|
|
|
266
|
|
|
5
|
7
|
|
|
7
|
|
31
|
use Time::Piece; |
|
|
7
|
|
|
|
|
31
|
|
|
|
7
|
|
|
|
|
40
|
|
|
6
|
7
|
|
|
7
|
|
448
|
use Class::Accessor::Lite; |
|
|
7
|
|
|
|
|
9
|
|
|
|
7
|
|
|
|
|
38
|
|
|
7
|
7
|
|
|
7
|
|
3665
|
use Time::List::Constant; |
|
|
7
|
|
|
|
|
19
|
|
|
|
7
|
|
|
|
|
38
|
|
|
8
|
7
|
|
|
7
|
|
1026904
|
use Encode qw/decode_utf8/; |
|
|
7
|
|
|
|
|
88088
|
|
|
|
7
|
|
|
|
|
5151
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.11'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my $unit_time = { |
|
13
|
|
|
|
|
|
|
DAY() => 3600 * 24 , |
|
14
|
|
|
|
|
|
|
WEEK() => 3600 * 24 * 7 , |
|
15
|
|
|
|
|
|
|
HOUR() => 3600 , |
|
16
|
|
|
|
|
|
|
}; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my %DEFAULTS = ( |
|
19
|
|
|
|
|
|
|
time_unit => DAY() , |
|
20
|
|
|
|
|
|
|
output_type => ARRAY() , |
|
21
|
|
|
|
|
|
|
limit_rows => 0 , |
|
22
|
|
|
|
|
|
|
input_strftime_form => '%Y-%m-%d %H:%M:%S', |
|
23
|
|
|
|
|
|
|
output_strftime_form => '%Y-%m-%d %H:%M:%S', |
|
24
|
|
|
|
|
|
|
show_end_time => 0 , |
|
25
|
|
|
|
|
|
|
end_time_separate_chars => '~' , |
|
26
|
|
|
|
|
|
|
unixtime => 0, |
|
27
|
|
|
|
|
|
|
datetime => 0, |
|
28
|
|
|
|
|
|
|
values => {}, |
|
29
|
|
|
|
|
|
|
); |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Class::Accessor::Lite->mk_accessors(keys %DEFAULTS); |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub new { |
|
34
|
33
|
|
|
33
|
1
|
55
|
my $class = shift; |
|
35
|
|
|
|
|
|
|
|
|
36
|
33
|
50
|
|
|
|
170
|
my %args = @_ == 1 ? %{ $_[0] } : @_; |
|
|
0
|
|
|
|
|
0
|
|
|
37
|
33
|
100
|
|
|
|
66
|
if($args{show_end_time}){ |
|
38
|
3
|
|
|
|
|
9
|
my ($unixtime) = split("\t",$args{unixtime}); |
|
39
|
3
|
|
|
|
|
10
|
$args{datetime} = localtime($unixtime)->strftime( '%Y-%m-%d %H:%M:%S'); |
|
40
|
|
|
|
|
|
|
}else{ |
|
41
|
30
|
|
|
|
|
78
|
$args{datetime} = localtime($args{unixtime})->strftime( '%Y-%m-%d %H:%M:%S'); |
|
42
|
|
|
|
|
|
|
} |
|
43
|
33
|
|
|
|
|
1174
|
decode_utf8($args{datetime}); |
|
44
|
33
|
|
|
|
|
948
|
my $self = bless { |
|
45
|
|
|
|
|
|
|
%DEFAULTS, |
|
46
|
|
|
|
|
|
|
values => {}, |
|
47
|
|
|
|
|
|
|
%args, |
|
48
|
|
|
|
|
|
|
}, $class; |
|
49
|
33
|
|
|
|
|
202
|
$self; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub set{ |
|
53
|
39
|
|
|
39
|
0
|
50
|
my ($self , $values) = @_; |
|
54
|
39
|
|
|
|
|
87
|
$self->values( |
|
55
|
39
|
|
|
|
|
44
|
{%{$self->values},%$values} |
|
56
|
|
|
|
|
|
|
); |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub get_hash_seed{ |
|
60
|
3
|
|
|
3
|
0
|
6
|
my ($self) = @_; |
|
61
|
3
|
|
|
|
|
8
|
my $values = $self->values; |
|
62
|
3
|
50
|
|
|
|
19
|
if($self->show_end_time){ |
|
63
|
0
|
|
|
|
|
0
|
join($self->end_time_separate_chars, |
|
64
|
0
|
|
|
|
|
0
|
map{decode_utf8(localtime($_)->strftime($self->output_strftime_form))}split("\t",$self->unixtime)) => $values; |
|
65
|
|
|
|
|
|
|
}else{ |
|
66
|
3
|
|
|
|
|
19
|
decode_utf8(localtime($self->unixtime)->strftime($self->output_strftime_form)) => $values; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub get_key{ |
|
71
|
105
|
|
|
105
|
0
|
125
|
my ($self) = @_; |
|
72
|
105
|
|
|
|
|
234
|
my $values = $self->values; |
|
73
|
|
|
|
|
|
|
|
|
74
|
105
|
100
|
|
|
|
502
|
if($self->show_end_time){ |
|
75
|
6
|
|
|
|
|
190
|
join($self->end_time_separate_chars, |
|
76
|
3
|
|
|
|
|
18
|
map{decode_utf8(localtime($_)->strftime($self->output_strftime_form))}split("\t",$self->unixtime)); |
|
77
|
|
|
|
|
|
|
}else{ |
|
78
|
102
|
|
|
|
|
517
|
decode_utf8(localtime($self->unixtime)->strftime($self->output_strftime_form)); |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub get_values{ |
|
83
|
105
|
|
|
105
|
0
|
563
|
my ($self) = @_; |
|
84
|
105
|
|
|
|
|
241
|
my $values = $self->values; |
|
85
|
|
|
|
|
|
|
|
|
86
|
105
|
|
|
|
|
609
|
$values->{$_} = $self->$_ for qw/datetime unixtime/; |
|
87
|
105
|
|
|
|
|
1113
|
$values->{output_time} = $self->get_key; |
|
88
|
105
|
|
|
|
|
5825
|
return $values; |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
1; |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
1; |
|
95
|
|
|
|
|
|
|
__END__ |