line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Acme::Time::Baby; |
2
|
|
|
|
|
|
|
|
3
|
16
|
|
|
16
|
|
161344
|
use strict; |
|
16
|
|
|
|
|
39
|
|
|
16
|
|
|
|
|
565
|
|
4
|
16
|
|
|
16
|
|
91
|
use warnings; |
|
16
|
|
|
|
|
32
|
|
|
16
|
|
|
|
|
544
|
|
5
|
16
|
|
|
16
|
|
76
|
no warnings 'syntax'; |
|
16
|
|
|
|
|
32
|
|
|
16
|
|
|
|
|
697
|
|
6
|
|
|
|
|
|
|
|
7
|
16
|
|
|
16
|
|
74
|
use vars qw /$VERSION/; |
|
16
|
|
|
|
|
29
|
|
|
16
|
|
|
|
|
15064
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '2010090301'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my %languages = ( |
12
|
|
|
|
|
|
|
'en' => {numbers => [qw /one two three four five six seven |
13
|
|
|
|
|
|
|
eight nine ten eleven twelve/], |
14
|
|
|
|
|
|
|
format => "The big hand is on the %s " . |
15
|
|
|
|
|
|
|
"and the little hand is on the %s"}, |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
'br' => {numbers => [split ' ' => |
18
|
|
|
|
|
|
|
qq /um dois tr\x{EA}s quatro cinco seis |
19
|
|
|
|
|
|
|
sete oito nove dez onze doze/], |
20
|
|
|
|
|
|
|
format => "O ponteiro grande est\x{E1} no %s " . |
21
|
|
|
|
|
|
|
"e o ponteiro pequeno est\x{E1} no %s"}, |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
'ceb' => {numbers => [qw /usa duha tulo upat lima unom pito |
24
|
|
|
|
|
|
|
walo siyam napulo/, |
25
|
|
|
|
|
|
|
"napulo'g usa", "napulo'g duha"], |
26
|
|
|
|
|
|
|
format => "Ang dako nga kamut naa sa %s " . |
27
|
|
|
|
|
|
|
"ang gamay nga kamut naa sa %s"}, |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
'de' => {numbers => [split ' ' => |
30
|
|
|
|
|
|
|
qq /Eins Zwei Drei Vier F\x{FC}nf Sechs Sieben |
31
|
|
|
|
|
|
|
Acht Neun Zehn Elf Zw\x{F6}lf/], |
32
|
|
|
|
|
|
|
format => "Der gro\x{DF}e Zeiger ist auf der %s " . |
33
|
|
|
|
|
|
|
"und der kleine Zeiger ist auf der %s"}, |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
'de_ch' => {numbers => [split ' ' => |
36
|
|
|
|
|
|
|
qq /eis zw\x{F6}i dr\x{FC} vieri f\x{F6}ifi |
37
|
|
|
|
|
|
|
s\x{E4}chsi sibni |
38
|
|
|
|
|
|
|
achti n\x{FC}ni z\x{E4}ni elfi |
39
|
|
|
|
|
|
|
zw\x{F6}lfi/], |
40
|
|
|
|
|
|
|
format => "De gross zeiger isch uf em %s " . |
41
|
|
|
|
|
|
|
"und de chlii zeiger isch uf em %s"}, |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
'du' => {numbers => [qw /een twee drie vier vijf zes zeven |
44
|
|
|
|
|
|
|
acht negen tien elf twaalf/], |
45
|
|
|
|
|
|
|
format => "De grote wijzer is op de %s " . |
46
|
|
|
|
|
|
|
"en de kleine wijzer is op de %s"}, |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
'es' => {numbers => [qw /uno dos tres cuatro cinco seis siete |
49
|
|
|
|
|
|
|
ocho nueve diez once doce/], |
50
|
|
|
|
|
|
|
format => "La manecilla grande est\x{E1} sobre el %s y " . |
51
|
|
|
|
|
|
|
"la manecilla peque\x{F1}a est\x{E1} sobre el %s"}, |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
'fr' => {numbers => [qw /un deux trois quatre cinq six sept |
54
|
|
|
|
|
|
|
huit neuf dix onze douze/], |
55
|
|
|
|
|
|
|
format => "La grande aiguille est sur le %s " . |
56
|
|
|
|
|
|
|
"et la petite aiguille est sur le %s"}, |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
'hr' => {numbers => [split ' ' => |
59
|
|
|
|
|
|
|
qq /jedan dva tri \x{010d}etiri pet \x{0161}est |
60
|
|
|
|
|
|
|
sedam osam devet deset jedanaest dvanaest/], |
61
|
|
|
|
|
|
|
format => "Velika kazaljka pokazuje %s " . |
62
|
|
|
|
|
|
|
"a mala kazaljka pokazuje %s"}, |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
'it' => {numbers => ['a una', 'e due', 'e tre', 'e quattro', |
65
|
|
|
|
|
|
|
'e cinque', 'e sei', 'e sette', |
66
|
|
|
|
|
|
|
'e otto', 'e nove', 'e dieci', |
67
|
|
|
|
|
|
|
'e undici', 'e dodici'], |
68
|
|
|
|
|
|
|
format => "La lancetta lunga e' sull%s " . |
69
|
|
|
|
|
|
|
"e quella corta e' sull%s"}, |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
'no' => {numbers => [split ' ' => |
72
|
|
|
|
|
|
|
qq /en to tre fire fem seks syv |
73
|
|
|
|
|
|
|
\x{E5}tte ni ti elleve tolv/], |
74
|
|
|
|
|
|
|
format => "Den store viseren er p\x{E5} %s " . |
75
|
|
|
|
|
|
|
"og den lille viseren er p\x{E5} %s"}, |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
'se' => {numbers => [split ' ' => |
78
|
|
|
|
|
|
|
qq /ett tv\x{E5} tre fyra fem sex sju |
79
|
|
|
|
|
|
|
\x{E5}tta nio tio elva tolv/], |
80
|
|
|
|
|
|
|
format => "Den stora visaren \x{E4}r p\x{E5} %s " . |
81
|
|
|
|
|
|
|
"och den lilla visaren \x{E4}r p\x{E5} %s"}, |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
'swedish chef' |
84
|
|
|
|
|
|
|
=> {numbers => [qw /one tvu three ffuoor ffeefe six |
85
|
|
|
|
|
|
|
sefen eight nine ten elefen tvelfe/], |
86
|
|
|
|
|
|
|
format => "Zee beeg hund is un zee %s und zee little " . |
87
|
|
|
|
|
|
|
"hund is un zee %s. Bork, bork, bork!"}, |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
'warez' => {numbers => [qw {()nE TW0 7HR3e f0uR f|ve 5ix |
90
|
|
|
|
|
|
|
ZE\/3n E|6hT n1nE TeN 3L3v3gn 7wELv3}], |
91
|
|
|
|
|
|
|
format => 'T|-|3 bIG h4|\||) Yz 0n thE %s ' . |
92
|
|
|
|
|
|
|
'and 7|-|3 lIttlE |-|aND |S 0|\| Th3 %s'}, |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
); |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
my @numbers = @{$languages {en} {numbers}}; |
97
|
|
|
|
|
|
|
my $format = $languages {en} {format}; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub import { |
100
|
16
|
|
|
16
|
|
124
|
my $class = shift; |
101
|
16
|
|
|
|
|
28
|
my $pkg = __PACKAGE__; |
102
|
16
|
|
|
|
|
35
|
my $caller = caller; |
103
|
|
|
|
|
|
|
|
104
|
16
|
|
|
|
|
40
|
my %args = @_; |
105
|
|
|
|
|
|
|
|
106
|
16
|
100
|
|
|
|
78
|
if ($args {language}) { |
107
|
13
|
50
|
|
|
|
57
|
if (exists $languages {$args {language}}) { |
108
|
13
|
|
|
|
|
208
|
@numbers = @{$languages {$args {language}} {numbers}}; |
|
13
|
|
|
|
|
83
|
|
109
|
13
|
|
|
|
|
43
|
$format = $languages {$args {language}} {format}; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
else { |
112
|
0
|
0
|
|
|
|
0
|
warn "There is no support for language `$args{language}'\n" if $^W; |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
16
|
100
|
|
|
|
63
|
@numbers = @{$args {numbers}} if exists $args {numbers}; |
|
1
|
|
|
|
|
15
|
|
117
|
16
|
100
|
|
|
|
82
|
$format = $args {format} if exists $args {format}; |
118
|
|
|
|
|
|
|
|
119
|
16
|
50
|
|
|
|
52
|
if (@numbers < 12) {die "You didn't pass in twelve numbers.\n";} |
|
0
|
|
|
|
|
0
|
|
120
|
|
|
|
|
|
|
|
121
|
16
|
|
|
16
|
|
97
|
no strict 'refs'; |
|
16
|
|
|
|
|
33
|
|
|
16
|
|
|
|
|
10761
|
|
122
|
16
|
100
|
|
|
|
1826
|
*{$caller . '::babytime'} = \&{__PACKAGE__ . '::babytime'} |
|
15
|
|
|
|
|
34797
|
|
|
15
|
|
|
|
|
41
|
|
123
|
|
|
|
|
|
|
unless $args {noimport}; |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub babytime { |
127
|
21600
|
|
|
21600
|
0
|
1328250
|
my ($hours, $minutes); |
128
|
21600
|
50
|
|
|
|
56482
|
if (@_) { |
129
|
21600
|
50
|
|
|
|
138478
|
($hours, $minutes) = $_ [0] =~ /^(\d+):(\d+)$/ |
130
|
|
|
|
|
|
|
or die "$_[0] is not of the form hh:mm\n"; |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
else { |
133
|
0
|
|
|
|
|
0
|
($hours, $minutes) = (localtime) [2, 1]; |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
21600
|
100
|
|
|
|
63925
|
$hours ++ if $minutes > 30; |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
# Turn $hours into 1 .. 12 format. |
139
|
21600
|
|
|
|
|
29006
|
$hours %= 12; |
140
|
21600
|
|
100
|
|
|
62148
|
$hours ||= 12; |
141
|
|
|
|
|
|
|
|
142
|
21600
|
50
|
|
|
|
41425
|
die "There are just 60 minutes in an hour\n" if $minutes >= 60; |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
# Round minutes to nearest 5 minute. |
145
|
21600
|
|
|
|
|
51522
|
$minutes = sprintf "%.0f" => $minutes / 5; |
146
|
21600
|
|
100
|
|
|
42623
|
$minutes ||= 12; |
147
|
|
|
|
|
|
|
|
148
|
21600
|
|
|
|
|
110055
|
sprintf $format => @numbers [$minutes - 1, $hours - 1]; |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
1; |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
__END__ |