in reply to (OT) Perl Snacks

I know! I'll make it on-topic!

#!/usr/bin/perl -w use Food; use Cookware; use strict; my $roll = new Food('roll'); $roll->cut_in(2); for (@{$roll->parts}) { $_->add_item('cheese') } $roll->cook(-method => 'grill'); my $egg = new Food('egg'); $egg->crack( -into => Cookware::frypan ); $egg->cook( -method => 'fry', -using => $egg->cracked_into ); $egg->wait_for_done && $roll->stop_cooking; ## wait_for_done implies $egg->stop_cooking $roll->parts[0]->add_item($egg); $roll->reassemble; $roll->consume; print "Mmm... tasty" if ($roll->was_eaten && $roll->was_tasty); #Digest Roll patch by thor, with minor mods $roll->use('Digest::MD5'); $roll->{MD5}->digest;

It needs a digestion patch, but that should be it -- thor inspired a patch to digest the roll as well.

Perl's automatic garbage collection should take care of the rest. ;-P


radiantmatrix
require General::Disclaimer;
Perl is

Replies are listed 'Best First'.
Re^2: (OT) Perl Snacks
by thor (Priest) on Nov 10, 2004 at 23:44 UTC
    Digest, eh?
    use Digest::MD5 qw(md5_hex); md5_hex($roll);
    ;)

    thor

    Feel the white light, the light within
    Be your own disciple, fan the sparks of will
    For all of us waiting, your kingdom will come

Re^2: (OT) Perl Snacks
by monoxide (Beadle) on Nov 11, 2004 at 01:42 UTC
    Thankyou radiantmatrix, i actually intended to do this in the original post.... hence the semblance of a code section in the original post (now replaced with yours). :) have fun and enjoy! :)