use coffee; my $mug = new coffee; while () { while (!$mug->empty()) { slurp($mug;) } $mug->getmorecoffee or die(); }

Replies are listed 'Best First'.
RE (tilly) 1: coffee
by tilly (Archbishop) on Sep 06, 2000 at 23:46 UTC
    I wouldn't die, instead for me that should be:
    $mug->get_more_coffee or sleep(3600);
RE: coffee
by Maclir (Curate) on Sep 07, 2000 at 07:08 UTC
    while (!$mug->empty()) { slurp($mug;) }
    A question - is the slurp method of the coffee class greedy?

    As well, if the coffee in question is the lovely greek or turkish kind, I would recommend that the while loop should be modified to be :

    { slurp(chomp($mug)) }
    to avoid slurping the "mud" at the bottom.

    Macaffine-lair

RE: coffee
by kilinrax (Deacon) on Sep 07, 2000 at 20:13 UTC
    Why restrict yourself to just coffee? I have at least 4 regular sources of caffeine:
    #!/usr/bin/perl -w require 5; use strict; use vars qw($taste %boiling); my @insults = ('hack','blech','blort','yeuch'); eval { require Starbucks::Frappuccino } and print("Sluuurp") and exit or warn("You haven't got a Starbucks???") and eval { require Penguin::Mints } and print("Munch Munch") and exit or warn("Argh, I need caffeine!") and eval { Kitchen::Fridge->content('drinks') =~ /coke/ } and print("Sluurp") and exit or warn("There's no cold coke, dammit :-(") and eval { Kitchen::Cupboard->content('jars') =~ /coffee/ } and make_coffee( Kitchen::Cupboard->content('jars') ) and exit or warn("No coffee, what the hell?"); sleep( (4 + rand(15)) * 3600) unless die (); sub make_coffee($){ my $jar = shift; my $coffee = grep { /paper/ } ($jar, $boiling{'water'}); print("Sluuurp"); eval { $taste } or study $jar; if ($jar =~ /instant/) { warn($insults[rand @insults]); warn('This coffee sucks :-('); } else { print "Mmmmm..... coffee...." } }
RE: coffee
by gumpu (Friar) on Sep 07, 2000 at 12:11 UTC

    Love it :)

    And the poem and especially the die part is very appropriate to our current situation here at work. The haven't refilled the coffee machines for two days in a day now -- two days without coffee. People are about to start a riot, while others just sit infront of their monitor, hands shaking, and eyes gazing abscently in the distance... :) I printed the poem and its now decorating the door to the room with the coffee machine.

    Have Fun

RE: coffee
by cwest (Friar) on Sep 06, 2000 at 23:06 UTC