line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::WhatTimeIsIt; |
2
|
2
|
|
|
2
|
|
57743
|
use strict; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
67
|
|
3
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
50
|
|
4
|
2
|
|
|
2
|
|
2006
|
use Time::Local (); |
|
2
|
|
|
|
|
5197
|
|
|
2
|
|
|
|
|
47
|
|
5
|
2
|
|
|
2
|
|
2586
|
use POSIX (); |
|
2
|
|
|
|
|
16538
|
|
|
2
|
|
|
|
|
94
|
|
6
|
2
|
|
|
2
|
|
2001
|
use Config::CmdRC '.what_time_is_it'; |
|
2
|
|
|
|
|
53672
|
|
|
2
|
|
|
|
|
16
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my $FORMAT = "%a, %d %b %Y %H:%M"; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
13
|
0
|
|
|
0
|
1
|
|
my ($class, $opt) = @_; |
14
|
0
|
|
|
|
|
|
bless { opt => $opt } => $class; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
0
|
1
|
|
sub opt { $_[0]->{opt} } |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub run { |
20
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
0
|
|
|
|
my $format = $self->opt->{'--format'} || RC->{format} || $FORMAT; |
23
|
0
|
0
|
0
|
|
|
|
my $out = ($self->opt->{'--stderr'} || RC->{stderr}) ? *STDERR : *STDOUT; |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
my $gmt = Time::Local::timegm(gmtime); |
26
|
|
|
|
|
|
|
|
27
|
0
|
0
|
|
|
|
|
for my $data (@{$self->opt->{'--city'}}, @{RC->{city} || []}) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
28
|
0
|
|
0
|
|
|
|
my ($city, $offset) = split ':', ($data || ''); |
29
|
0
|
|
|
|
|
|
my $date = POSIX::strftime( |
30
|
|
|
|
|
|
|
$format, |
31
|
|
|
|
|
|
|
gmtime($gmt + $offset*60*60), |
32
|
|
|
|
|
|
|
); |
33
|
0
|
|
|
|
|
|
print $out "$city\t$date\n"; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__END__ |