| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Acme::Time::FooClock; |
|
2
|
5
|
|
|
5
|
|
25
|
use strict; |
|
|
5
|
|
|
|
|
12
|
|
|
|
5
|
|
|
|
|
265
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
5
|
|
|
5
|
|
310
|
BEGIN { |
|
5
|
|
|
|
|
|
|
} |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# Documentation {{{ |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Acme::Time::FooClock - Base class for picture clocks |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Used for making arbitrary picture-clock classes. |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use Acme::Time::FooClock; |
|
18
|
|
|
|
|
|
|
$times = [ |
|
19
|
|
|
|
|
|
|
'Tomato', 'Eggplant', 'Carrot', 'Garlic', |
|
20
|
|
|
|
|
|
|
'Green Onion', 'Pumpkin', 'Asparagus', 'Onion', |
|
21
|
|
|
|
|
|
|
'Corn', 'Brussels Sprout', 'Red Pepper', 'Cabbage', |
|
22
|
|
|
|
|
|
|
]; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub footime() { |
|
25
|
|
|
|
|
|
|
return Acme::Time::FooClock::time(shift); |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
"And now it's time for silly songs with Larry." |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Figures out time on the vegetable clock. See |
|
33
|
|
|
|
|
|
|
http://DrBacchus.com/images/clock.jpg |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 BUGS/ToDo |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
I suppose one could consider the very existence of this module to be a |
|
38
|
|
|
|
|
|
|
bug. Also, I have never been quite sure if that thing was a brussel |
|
39
|
|
|
|
|
|
|
sprout or a cauliflower. |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
The input checking could probably be improved. |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Make it easier to extend for use with other varieties of clocks. I am |
|
44
|
|
|
|
|
|
|
considering having a more generic Acme::Time::Food, of which this would |
|
45
|
|
|
|
|
|
|
be a subclass. Subclasses would just pass in a listref of foods. This |
|
46
|
|
|
|
|
|
|
would make the module more useful to the sushi crowd, for example. |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Some way to convert back to "real" time from vegetable notation. |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 SUPPORT |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
You're kidding, right? Stop being so silly! |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 AUTHOR |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Rich 'DrBacchus' Bowen |
|
57
|
|
|
|
|
|
|
CPAN ID: RBOW |
|
58
|
|
|
|
|
|
|
rbowen@rcbowen.com |
|
59
|
|
|
|
|
|
|
http://www.DrBacchus.com/ |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Kudos to Kate L Pugh for submitting a patch, and demonstrating that |
|
62
|
|
|
|
|
|
|
there are other people in the world as silly as I am. |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Copyright (c) 2010 Rich Bowen. All rights reserved. |
|
67
|
|
|
|
|
|
|
This program is free software; you can redistribute |
|
68
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
The full text of the license can be found in the |
|
71
|
|
|
|
|
|
|
LICENSE file included with this module. |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 veggietime |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
print veggietime('5:17'); |
|
76
|
|
|
|
|
|
|
print veggietime; # defaults to current time |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Returns the veggie time equivalent of a 12-hour time expressed in the |
|
79
|
|
|
|
|
|
|
format hh:mm. Will round to the nearest vegetable. |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# }}} |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
# sub time {{{ |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub time { |
|
88
|
20
|
|
|
20
|
0
|
36
|
my $time = shift; |
|
89
|
20
|
|
|
|
|
42
|
my $class =caller(); |
|
90
|
|
|
|
|
|
|
|
|
91
|
20
|
|
|
|
|
29
|
my $times; |
|
92
|
|
|
|
|
|
|
{ |
|
93
|
5
|
|
|
5
|
|
28
|
no strict 'refs'; |
|
|
5
|
|
|
|
|
9
|
|
|
|
5
|
|
|
|
|
1674
|
|
|
|
20
|
|
|
|
|
21
|
|
|
94
|
20
|
|
|
|
|
24
|
$times = ${ $class . '::times' }; |
|
|
20
|
|
|
|
|
82
|
|
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
20
|
|
|
|
|
29
|
my ($h, $m); |
|
98
|
|
|
|
|
|
|
|
|
99
|
20
|
50
|
|
|
|
43
|
if ($time) { |
|
100
|
20
|
|
|
|
|
75
|
($h, $m) = split /:/, $time; |
|
101
|
|
|
|
|
|
|
} else { |
|
102
|
0
|
|
|
|
|
0
|
my @t = localtime; |
|
103
|
0
|
|
|
|
|
0
|
$h=$t[2]; |
|
104
|
0
|
|
|
|
|
0
|
$m=$t[1]; |
|
105
|
|
|
|
|
|
|
} |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
# o/~ We are the pirates who don't do anything o/~ |
|
108
|
20
|
|
|
|
|
64
|
my $v = ( int( $m / 5 + 0.5 ) ); |
|
109
|
20
|
50
|
|
|
|
53
|
if ( $v == 12 ) { |
|
110
|
0
|
|
|
|
|
0
|
$v = 0; |
|
111
|
0
|
|
|
|
|
0
|
$h += 1; |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
|
|
114
|
20
|
100
|
|
|
|
71
|
$h-=12 if $h>12; |
|
115
|
|
|
|
|
|
|
|
|
116
|
20
|
100
|
|
|
|
77
|
if ($v == 0) { |
|
|
|
100
|
|
|
|
|
|
|
117
|
6
|
|
|
|
|
41
|
return $times->[$h - 1]; |
|
118
|
|
|
|
|
|
|
} elsif ($v > 6) { # Won't you join me in my irritating little song? |
|
119
|
4
|
|
|
|
|
29
|
$h++; |
|
120
|
4
|
50
|
|
|
|
35
|
$h=1 if $h==13; |
|
121
|
4
|
|
|
|
|
97
|
return $times->[$v - 1] . ' before ' . $times->[$h - 1]; |
|
122
|
|
|
|
|
|
|
} else { # It would be an honor! |
|
123
|
10
|
|
|
|
|
70
|
return $times->[$v - 1] . ' past ' . $times->[$h - 1]; |
|
124
|
|
|
|
|
|
|
} |
|
125
|
|
|
|
|
|
|
} # }}} |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
"Look. It's a cebu!"; |
|
128
|
|
|
|
|
|
|
|