Good show! Might I suggest importing a dishwasher object from the kitchen module, though, in which case the process might be a little shorter....

#!/usr/bin/perl use strict; use warnings; use kitchen qw(kitchenSink dishwasher); my $sink = new kitchenSink; my @dirties = kitchenSink->get('DIRTIES'); my $washer = new dishwasher( 'dry_method' => 'heat', 'wash_cycle' => 'high' ); while (@dirties) { $washer->load(shift @dirties) while (not $washer->is_full); $washer->add('detergent'); $washer->add('rinse_agent') if ($washer->has_a('rinse_agent_dispenser')); $washer->close('door'); $washer->run; my @clean = $washer->unload; while (@clean) { put_away($_, getLocation($_)); } } print "We're done!\n";

This does assume, however, that the version of the kitchen module used has support for a dishwasher object, though.

If you want to be really "on the ball", you might want to look at using multiple processes or threads, so the next washing/unload actions could be in progress while you are putting away the previous load's clean dishes.


In reply to Re: Cleaning the Monastery dishes by atcroft
in thread Cleaning the Monastery dishes by jkva

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.