| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package POE::Component::IRC::Plugin::WWW::Google::Time; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
386789
|
use warnings; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
41
|
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
140
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.0102'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
6
|
use base 'POE::Component::IRC::Plugin::BasePoCoWrap'; |
|
|
1
|
|
|
|
|
7
|
|
|
|
1
|
|
|
|
|
104
|
|
|
9
|
1
|
|
|
1
|
|
6
|
use POE qw/Component::WWW::Google::Time/; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
7
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub _make_default_args { |
|
12
|
|
|
|
|
|
|
return ( |
|
13
|
0
|
|
|
0
|
|
|
response_event => 'irc_google_time', |
|
14
|
|
|
|
|
|
|
trigger => qr/^time\s+(?=\S)/i, |
|
15
|
|
|
|
|
|
|
); |
|
16
|
|
|
|
|
|
|
} |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub _make_poco { |
|
19
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
20
|
0
|
0
|
|
|
|
|
return POE::Component::WWW::Google::Time->spawn( |
|
21
|
|
|
|
|
|
|
$self->{ua} ? ( ua => $self->{ua} ) : () |
|
22
|
|
|
|
|
|
|
); |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _make_response_message { |
|
26
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
27
|
0
|
|
|
|
|
|
my $in_ref = shift; |
|
28
|
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
my $prefix = ''; |
|
30
|
0
|
0
|
|
|
|
|
if ( $in_ref->{_type} eq 'public' ) { |
|
31
|
0
|
|
|
|
|
|
( $prefix ) = (split /!/, $in_ref->{_who}, 2)[0] . ', '; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
0
|
0
|
|
|
|
|
if ( exists $in_ref->{error} ) { |
|
35
|
0
|
|
|
|
|
|
return [ $prefix . lc $in_ref->{error} ]; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
else { |
|
38
|
|
|
|
|
|
|
return [ |
|
39
|
0
|
|
|
|
|
|
sprintf "%sit is %s, %s (%s) in %s\n", |
|
40
|
0
|
|
|
|
|
|
$prefix, @{ $in_ref->{result} }{ qw/day_of_week time time_zone where/ } |
|
41
|
|
|
|
|
|
|
]; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub _make_response_event { |
|
46
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
47
|
0
|
|
|
|
|
|
my $in_ref = shift; |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
return { |
|
50
|
0
|
|
|
|
|
|
( exists $in_ref->{error} |
|
51
|
|
|
|
|
|
|
? ( error => $in_ref->{error} ) |
|
52
|
|
|
|
|
|
|
: ( result => $in_ref->{result} ) |
|
53
|
|
|
|
|
|
|
), |
|
54
|
|
|
|
|
|
|
|
|
55
|
0
|
0
|
|
|
|
|
map { $_ => $in_ref->{"_$_"} } |
|
56
|
|
|
|
|
|
|
qw( who channel message type what ), |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub _make_poco_call { |
|
61
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
62
|
0
|
|
|
|
|
|
my $data_ref = shift; |
|
63
|
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
$self->{poco}->get_time( { |
|
65
|
|
|
|
|
|
|
event => '_poco_done', |
|
66
|
|
|
|
|
|
|
where => $data_ref->{what}, |
|
67
|
|
|
|
|
|
|
map +( "_$_" => $data_ref->{$_} ), |
|
68
|
|
|
|
|
|
|
keys %$data_ref, |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
); |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |
|
74
|
|
|
|
|
|
|
__END__ |