questioneer (owner)

Fork Of

Revisions

gist: 46976 Download_button fork
public
Public Clone URL: git://gist.github.com/46976.git
Embed All Files: show embed
brew.pl #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env perl
#
# Copyright (c) 2009 Michelle Steigerwalt <msteigerwalt.com>
# All rights reserved.
#
# Handy-dandy tea brewing timer. Uses Growl for messaging.
#
# Normal Mode:
# > brew oolong
# Steeping for five minutes.
#
# Help Mode:
# > brew -h oolong
# 2 tsp of oolong will yield 8 oz. of tea. Steep time 5 minutes.
#
# Optional -m tag for multiple infusions will add a minute to the
# steeping time to account for used leaves.
#
 
use Getopt::Long;
use Mac::Growl;
$Types = ["Steeping Complete", "Message notification"];
Mac::Growl::RegisterNotifications('teatimer', $Types, $Types);
 
GetOptions("h"=>\$helpmode, "m"=>\$multiple);
 
$teas = {};
$teas{'white'} = [3, 5];
$teas{'green'} = [2, 3];
$teas{'pearl'} = [1, 5];
$teas{'oolong'} = [2, 5];
$teas{'black'} = [2, 5];
$teas{'yerba'} = [3, 5];
$teas{'chamo'} = [3, 7];
$teas{'catnip'} = [1, 5];
 
$type = $ARGV[0];
if (!defined $teas{$type}) {
        print "I'm not familiar with $type tea, is it delicious?\n";
        print "Treating this tea as a black tea.\n";
        $type = 'black';
}
 
$steepfor = $teas{$type}[1];
#Brew an extra minute if this is a second infusion.
if ($multiple) {
        print "Adding a minute to steep time, as this is a secondary infusion.\n";
        $steepfor++;
}
 
if (defined $helpmode) {
        $ounces = $ARGV[1];
        if (!$ounces) { $ounces = 8; }
        $peroz = $teas{$type}[0];
        $tspns = $ounces * ($peroz/8);
        print "$tspns tsp of $type will yield $ounces oz. of tea. Steep time $steepfor minutes.\n";
        exit;
}
 
print "Steeping for $steepfor minutes.\n";
sleep $steepfor*60;
Mac::Growl::PostNotification('teatimer', "Steeping Complete", "Mmm, $type!", "Your tea has finished steeping. Please remove the infuser immediately.");