Re: Caffeine and its delivery to monks in need
by FoxtrotUniform (Prior) on May 15, 2002 at 15:27 UTC
|
Methinks that brother demerphq has the right idea,
but an unnecessarily restrictive namespace: I'd prefer
something like this:
So with that namespace in mind:
connect(Caffeine::Beverage::Intravenous->new(
"type" => "coffee",
"roast" => "light",
"strength" => "demitasse"),
$monks{"FoxtrotUniform"})
or warn "Matt's going to be grumpy: $!\n";
--
:wq | [reply] [d/l] |
Re: Caffiene and its delivery to monks in need
by Sinister (Friar) on May 15, 2002 at 11:35 UTC
|
Not so elegant (in more then one way) as my $CB_post, but sufficient...
splice(@$monk, $mouth, $#coffee, @coffee)
foreach $monk ( grep {/wants_coffee/} @monks );
er formait hyarya.
"Field experience is something you don't
get until just after you need it."
| [reply] [d/l] [select] |
Re: Caffeine and its delivery to monks in need
by vladb (Vicar) on May 15, 2002 at 12:55 UTC
|
Hehe, this would be my 'losy' attempt at serving coffee!
for (grep {$_->is_early_tired() && $_->requires_coffee()} @cb_monks) {
do {
$_->consume(Hot::Coffee->new($_->get_coffee_prefs()));
while ($_->more_coffee_wont_hurt());
}
Note that I'm not a big expert on customer care ;).
_____________________
$"=q;grep;;$,=q"grep";for(`find . -name ".saves*~"`){s;$/;;;/(.*-(\d+)
+-.*)$/;$_=["ps -e -o pid | "," $2 | "," -v "," "];`@$_`?{print"+ $1"}
+:{print"- $1"}&&`rm $1`;print"\n";}
| [reply] [d/l] [select] |
(wil) Re: Caffeine and its delivery to monks in need
by wil (Priest) on May 15, 2002 at 13:07 UTC
|
++broquaint
I love this node! This really amused me how much this great community of Perl hackers are determined to make everything possible with Perl.
I had to add to this thread, so here's my attempt:
my $i = $caffeine_level;
for ($i = 0; $i < 100; ++$i) {
push (@monk_needs,$caffiene);
}
- wil | [reply] [d/l] |
|
my $i = $caffeine_level;
for ($i = 0; $i < 100; ++$i) {
The first assignment is useless, as $i's value is immediately overwritten. The loop is inefficient, as for simple loops like this, a Perlish loop is faster and easier to write: for (1..100). Yes, I changed it from 0..99 to 1..100, because 1..100 looks better and you're not using the iterator variable anyway.
- Yes, I reinvent wheels.
- Spam: Visit eurotraQ.
| [reply] [d/l] [select] |
Re: Caffeine and its delivery to monks in need
by Rex(Wrecks) (Curate) on May 15, 2002 at 17:13 UTC
|
A semi-OO way :)
Called as: ./Caffeine.pl kenya_AA high am 10 Here is the code:
use IV::Caffeine ;
my $favorite_poison = shift ;
my $flowrate = shift ;
my $time_of_day = shift ;
my $groggy = shift ;
if ($time_of_day ne "pm"){$time_of_day = "am" ;}
while ($time_of_day eq "am" || $time_of_day = "pm")
{
my $leftarm = "InnerLeftElbow" ;
my $rightarm = "InnerRightElbow" ;
$injector = new IV::Caffeine(Poison => $favorite_poison, NeedleSize
+ => $flowrate)
$injector->pierce_skin($leftarm) ;
$injector->pierce_skin($rightarm) ;
$injector->begin_flow ;
if ($groggy >= 5) {$injector->increase_flow($leftarm, $rightarm) ;}
}
"Nothing is sure but death and taxes" I say combine the two and its death to all taxes! | [reply] [d/l] [select] |
Re: Caffeine and its delivery to monks in need
by artist (Parson) on May 15, 2002 at 14:28 UTC
|
Hi,
Would some one please tell me, why associate Caffeine
with perl. After all, there is more than one way to achieve.
Point of view
of
an artist.
| [reply] |
|
@foibles = qw( caffiene pizza ... );
foreach $monk (@perlmonks) {
push @{ $monk->{toConsume} },
grep { exists $monk->{vices}{$_} } @foibles;
}
| [reply] [d/l] |
|
You are absolutely right! We musn't forget nicotine (in some cases that is) and pizza in this lovely thread!
foreach $self ( keys %monks ) {
$monks{$self}->{$_}++ foreach(qw(caffeine nicotine pizza))
}
er formait hyarya.
"Field experience is something you don't
get until just after you need it."
| [reply] [d/l] |
|
Surely you jest and mean:
&smoke while (1);
cancer SMiTZ
| [reply] [d/l] |
Re: Caffeine and its delivery to monks in need
by Juerd (Abbot) on May 15, 2002 at 17:00 UTC
|
perl -MLWP::Simple -e'get "http://www.peppermints.com/"'
Note: This is not intended as spam. I just like Penguin Mints. Disclaimer: I hereby disclaim all responsibility for caffeine overdoses.
- Yes, I reinvent wheels.
- Spam: Visit eurotraQ.
| [reply] |
|
I would have to change that to
perl -MLWP::Simple -e'get "http://www.peets.com/'
My dream is to open a Peets out here in Ohio some day.
()-()
\"/
`
| [reply] [d/l] |
Moose Roast
by rhesa (Vicar) on Apr 15, 2007 at 00:57 UTC
|
package PerlMonk::Fix;
use Moose;
extends 'PerlMonk';
augment 'productivity' => \&with_coffee;
before 'breakfast' => \&serve_coffee;
around 'lunch' => \&serve_coffee;
after 'dinner' => \&serve_coffee;
no Moose;
| [reply] [d/l] |
Re: Caffeine and its delivery to monks in need
by QwertyD (Pilgrim) on May 18, 2002 at 01:37 UTC
|
$bloodstream = chomp(<COFFEEBEANS>);
For once, a node about Java that's squarely on topic!
(Please don't hurt me because I'm a punster.)
How do I love -d? Let me count the ways... | [reply] [d/l] |
Re: Caffeine and its delivery to monks in need
by newrisedesigns (Curate) on Jun 20, 2002 at 03:24 UTC
|
#!/usr/bin/perl -w
use strict;
use LWP::Simple;
my $url = 'http://perlmonks.org/index.pl?';
my @usernames;
my $xml = get("${url}node_id=15851");
my @ret = split(/\n/, $xml);
@ret = grep(/\A\<user/, @ret);
foreach (@ret){
/username="([\w\d\ \$\.\%\@\-]*)"/;
push(@usernames, $1);
}
foreach (@usernames){
s/\s/_/g;
print $_;
get("${url}op=message&message=/msg\%20$_\%20Here's+some+coffee.+Enjoy.
+");
}
If anyone else wants to make it work... be my guest.
John J Reiser
newrisedesigns.com | [reply] [d/l] |
Re: Caffeine and its delivery to monks in need
by Aristotle (Chancellor) on May 18, 2002 at 05:35 UTC
|
push @{$_->{glass}}, pop @soda foreach @monk;
____________ Makeshifts last the longest. | [reply] [d/l] |