File Coverage

blib/lib/Acme/Time/Asparagus.pm
Criterion Covered Total %
statement 20 20 100.0
branch 2 2 100.0
condition n/a
subroutine 6 6 100.0
pod 0 1 0.0
total 28 29 96.5


line stmt bran cond sub pod time code
1             package Acme::Time::Asparagus;
2 2     2   58039 use strict;
  2         5  
  2         101  
3              
4             BEGIN {
5 2     2   12 use Exporter();
  2         4  
  2         43  
6 2     2   11 use vars qw (@ISA @EXPORT $times );
  2         7  
  2         182  
7 2     2   1254 use Acme::Time::FooClock;
  2         6  
  2         127  
8              
9 2     2   38 @ISA = qw (Exporter Acme::Time::FooClock);
10 2         6 @EXPORT = qw ( veggietime );
11              
12             # Got your own clock with different veggies?
13             # See Acme::Time::FooClock for details about making arbitrary
14             # picture clock modules.
15 2         681 $times = [
16             'Tomato', 'Eggplant', 'Carrot', 'Garlic',
17             'Green Onion', 'Pumpkin', 'Asparagus', 'Onion',
18             'Corn', 'Brussels Sprout', 'Red Pepper', 'Cabbage',
19             ];
20             }
21              
22             # Documentation {{{
23              
24             =head1 NAME
25              
26             Acme::Time::Asparagus - Time on the vegetable clock
27              
28             =head1 SYNOPSIS
29              
30             use Acme::Time::Asparagus qw(veggietime);
31             print veggietime('12:40');
32              
33             # In version 1.04, you could ask for a particular language, which
34             # seemed like a good idea at the time, but was very restricting
35             print veggietime('5:07', 'en_GB');
36             # Note that this will generate a warning. So you probably don't want
37             # to do this. But I didn't want to screw people up too badly.
38              
39             =head1 DESCRIPTION
40              
41             "And now it's time for silly songs with Larry."
42              
43             Figures out time on the vegetable clock. See
44             http://www.DrBacchus.com/images/clock.jpg See also the README for a URL
45             for a Sushi clock.
46              
47             =head1 BUGS/ToDo
48              
49             I suppose one could consider the very existence of this module to be a
50             bug. Also, I have never been quite sure if that thing was a brussels
51             sprout or a cauliflower.
52              
53             The input checking could probably be improved.
54              
55             Some way to convert back to "real" time from vegetable notation.
56              
57             =head1 SUPPORT
58              
59             You're kidding, right? Stop being so silly!
60              
61             =head1 AUTHOR
62              
63             Rich 'DrBacchus' Bowen
64             CPAN ID: RBOW
65             rich@DrBacchus.com
66             http://www.DrBacchus.com/
67              
68             Kudos to Kate L Pugh for submitting a patch, and demonstrating that
69             there are other people in the world as silly as I am. That stuff has now
70             been moved out into Acme::Time::Aubergine.
71              
72             See also C for more information.
73              
74             =head1 COPYRIGHT
75              
76             Copyright (c) 2009 Rich Bowen. All rights reserved.
77             This program is free software; you can redistribute
78             it and/or modify it under the same terms as Perl itself.
79              
80             The full text of the license can be found in the
81             LICENSE file included with this module.
82              
83             =cut
84              
85             # }}}
86              
87             # sub veggietime {{{
88              
89             =head1 veggietime
90              
91             print veggietime('5:17');
92             print veggietime; # defaults to current time
93              
94             Returns the veggie time equivalent of a 12-hour time expressed in the
95             format hh:mm. Will round to the nearest vegetable.
96              
97             =cut
98              
99             sub veggietime {
100            
101             # Warn folks that are trying to use the language argument
102 6 100   6 0 26 if ($_[1]) {
103 1         54 warn "\nWarning: Language argument is deprecated. You probably want to use Acme::Time::Aubergine\n";
104 1         667 require Acme::Time::Aubergine;
105 1         7 return Acme::Time::Aubergine::veggietime($_[0]);
106             }
107 5         17 return Acme::Time::FooClock::time(shift);
108             } # }}}
109              
110             "Look. It's a cebu!";
111