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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |