|  line  | 
 stmt  | 
 bran  | 
 cond  | 
 sub  | 
 pod  | 
 time  | 
 code  | 
| 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 package Time::List::Rows::Row;  | 
| 
2
 | 
7
 | 
 
 | 
 
 | 
  
7
  
 | 
 
 | 
111
 | 
 use 5.008_001;  | 
| 
 
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
16
 | 
    | 
| 
 
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
222
 | 
    | 
| 
3
 | 
7
 | 
 
 | 
 
 | 
  
7
  
 | 
 
 | 
24
 | 
 use strict;  | 
| 
 
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
8
 | 
    | 
| 
 
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
176
 | 
    | 
| 
4
 | 
7
 | 
 
 | 
 
 | 
  
7
  
 | 
 
 | 
31
 | 
 use warnings;  | 
| 
 
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
18
 | 
    | 
| 
 
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
233
 | 
    | 
| 
5
 | 
7
 | 
 
 | 
 
 | 
  
7
  
 | 
 
 | 
24
 | 
 use Time::Piece;  | 
| 
 
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
16
 | 
    | 
| 
 
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
36
 | 
    | 
| 
6
 | 
7
 | 
 
 | 
 
 | 
  
7
  
 | 
 
 | 
368
 | 
 use Class::Accessor::Lite;  | 
| 
 
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
11
 | 
    | 
| 
 
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
27
 | 
    | 
| 
7
 | 
7
 | 
 
 | 
 
 | 
  
7
  
 | 
 
 | 
2387
 | 
 use Time::List::Constant;  | 
| 
 
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
16
 | 
    | 
| 
 
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
30
 | 
    | 
| 
8
 | 
7
 | 
 
 | 
 
 | 
  
7
  
 | 
 
 | 
3888
 | 
 use Encode qw/decode_utf8/;  | 
| 
 
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
63086
 | 
    | 
| 
 
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
4379
 | 
    | 
| 
9
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
10
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 our $VERSION = '0.13';  | 
| 
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
  
 | 
35
 | 
     my $class = shift;  | 
| 
35
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       | 
| 
36
 | 
33
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
140
 | 
     my %args = @_ == 1 ? %{ $_[0] } : @_;  | 
| 
 
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
    | 
| 
37
 | 
33
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
50
 | 
     if($args{show_end_time}){  | 
| 
38
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
9
 | 
         my ($unixtime) = split("\t",$args{unixtime});  | 
| 
39
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
7
 | 
         $args{datetime} = localtime($unixtime)->strftime( '%Y-%m-%d %H:%M:%S');  | 
| 
40
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }else{  | 
| 
41
 | 
30
 | 
 
 | 
 
 | 
 
 | 
 
 | 
53
 | 
         $args{datetime} = localtime($args{unixtime})->strftime( '%Y-%m-%d %H:%M:%S');  | 
| 
42
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
43
 | 
33
 | 
 
 | 
 
 | 
 
 | 
 
 | 
974
 | 
     decode_utf8($args{datetime});  | 
| 
44
 | 
33
 | 
 
 | 
 
 | 
 
 | 
 
 | 
754
 | 
     my $self = bless {  | 
| 
45
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         %DEFAULTS,  | 
| 
46
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         values => {},  | 
| 
47
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         %args,  | 
| 
48
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }, $class;  | 
| 
49
 | 
33
 | 
 
 | 
 
 | 
 
 | 
 
 | 
179
 | 
     $self;  | 
| 
50
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
51
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
52
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub set{  | 
| 
53
 | 
39
 | 
 
 | 
 
 | 
  
39
  
 | 
  
0
  
 | 
38
 | 
     my ($self , $values)  = @_;  | 
| 
54
 | 
39
 | 
 
 | 
 
 | 
 
 | 
 
 | 
62
 | 
     $self->values(  | 
| 
55
 | 
39
 | 
 
 | 
 
 | 
 
 | 
 
 | 
28
 | 
         {%{$self->values},%$values}  | 
| 
56
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     );  | 
| 
57
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
58
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
59
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub get_hash_seed{  | 
| 
60
 | 
3
 | 
 
 | 
 
 | 
  
3
  
 | 
  
0
  
 | 
3
 | 
     my ($self)  = @_;  | 
| 
61
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
6
 | 
     my $values = $self->values;  | 
| 
62
 | 
3
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
15
 | 
     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
 | 
 
 | 
 
 | 
 
 | 
 
 | 
13
 | 
         decode_utf8(localtime($self->unixtime)->strftime($self->output_strftime_form)) => $values;  | 
| 
67
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
68
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
69
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
70
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub get_key{  | 
| 
71
 | 
153
 | 
 
 | 
 
 | 
  
153
  
 | 
  
0
  
 | 
124
 | 
     my ($self)  = @_;  | 
| 
72
 | 
153
 | 
 
 | 
 
 | 
 
 | 
 
 | 
240
 | 
     my $values = $self->values;  | 
| 
73
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
74
 | 
153
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
475
 | 
     if($self->show_end_time){  | 
| 
75
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
143
 | 
         join($self->end_time_separate_chars,   | 
| 
76
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
12
 | 
         map{decode_utf8(localtime($_)->strftime($self->output_strftime_form))}split("\t",$self->unixtime));  | 
| 
77
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }else{  | 
| 
78
 | 
150
 | 
 
 | 
 
 | 
 
 | 
 
 | 
536
 | 
         decode_utf8(localtime($self->unixtime)->strftime($self->output_strftime_form));  | 
| 
79
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
80
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
81
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
82
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub get_values{  | 
| 
83
 | 
153
 | 
 
 | 
 
 | 
  
153
  
 | 
  
0
  
 | 
524
 | 
     my ($self)  = @_;  | 
| 
84
 | 
153
 | 
 
 | 
 
 | 
 
 | 
 
 | 
236
 | 
     my $values = $self->values;  | 
| 
85
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
86
 | 
153
 | 
 
 | 
 
 | 
 
 | 
 
 | 
593
 | 
     $values->{$_} = $self->$_ for qw/datetime unixtime/;  | 
| 
87
 | 
153
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1204
 | 
     $values->{output_time} = $self->get_key;  | 
| 
88
 | 
153
 | 
 
 | 
 
 | 
 
 | 
 
 | 
6684
 | 
     return $values;  | 
| 
89
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
90
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
91
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 1;  | 
| 
92
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
93
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
94
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 1;  | 
| 
95
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 __END__  |