Acme-FishFarm
view release on metacpan or search on metacpan
docs/Acme-FishFarm-WaterLevelMaintainer-1.01.html view on Meta::CPAN
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Acme::FishFarm::WaterLevelMaintainer - Water Level Maintainer for Acme::FishFarm</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>
<body>
<ul id="index">
<li><a href="#NAME">NAME</a></li>
<li><a href="#VERSION">VERSION</a></li>
<li><a href="#SYNOPSIS">SYNOPSIS</a></li>
<li><a href="#EXPORT">EXPORT</a></li>
<li><a href="#CREATION-RELATED-MEHODS">CREATION RELATED MEHODS</a>
<ul>
<li><a href="#install-options">install ( %options )</a></li>
</ul>
</li>
<li><a href="#WATER-LEVEL-DETECTION-RELATED-METHODS">WATER LEVEL DETECTION RELATED METHODS</a>
<ul>
<li><a href="#current_water_level-new_water_level">current_water_level ( $new_water_level )</a></li>
<li><a href="#low_water_level_threshold1">low_water_level_threshold</a></li>
<li><a href="#set_low_water_level_threshold-new_threshold">set_low_water_level_threshold ( $new_threshold )</a></li>
<li><a href="#is_low_water_level">is_low_water_level</a></li>
</ul>
</li>
<li><a href="#PUMPS-RELATED-METHODS">PUMPS RELATED METHODS</a>
<ul>
<li><a href="#water_level_increase_height">water_level_increase_height</a></li>
<li><a href="#set_water_level_increase_height-new_height">set_water_level_increase_height ( $new_height )</a></li>
<li><a href="#pump_water_in">pump_water_in</a></li>
</ul>
</li>
<li><a href="#AUTHOR">AUTHOR</a></li>
<li><a href="#BUGS">BUGS</a></li>
<li><a href="#SUPPORT">SUPPORT</a></li>
<li><a href="#ACKNOWLEDGEMENTS">ACKNOWLEDGEMENTS</a></li>
<li><a href="#LICENSE-AND-COPYRIGHT">LICENSE AND COPYRIGHT</a></li>
</ul>
<h1 id="NAME">NAME</h1>
<p>Acme::FishFarm::WaterLevelMaintainer - Water Level Maintainer for Acme::FishFarm</p>
<h1 id="VERSION">VERSION</h1>
<p>Version 1.01</p>
<h1 id="SYNOPSIS">SYNOPSIS</h1>
<pre><code> use 5.010;
use Acme::FishFarm qw( reduce_precision );
use Acme::FishFarm::WaterFiltration;
my $water_level = Acme::FishFarm::WaterLevelMaintainer->install;
say "Water level maintainer installed and switched on!\n";
my $height_increase;
my $water_level_threshold;
my $current_reading;
while ( "Fish are living under the water..." ) {
$current_reading = reduce_precision( rand(10) );
$height_increase = $water_level->water_level_increase_height;
$water_level_threshold = $water_level->low_water_level_threshold;
$water_level->current_water_level( $current_reading ); # input by user
print "Current Water Level: ", $current_reading, " m (low: < ", $water_level_threshold, " m)\n";
if ( $water_level->is_low_water_level ) {
print " !! Water level is low!\n";
$water_level->pump_water_in;
print " Pumping in ", $height_increase, " m of water...\n";
print "Current Water Level: ", $water_level->current_water_level, "\n";
} else {
print " Water level is still normal.\n";
}
sleep(1);
say "";
}</code></pre>
<h1 id="EXPORT">EXPORT</h1>
<p>None</p>
<h1 id="CREATION-RELATED-MEHODS">CREATION RELATED MEHODS</h1>
<h2 id="install-options">install ( %options )</h2>
<p>Installs a water level maintainer system. This system only pumps water in if the water level is lower than the threshold value.</p>
<p>The supported <code>%options</code> are:</p>
<dl>
<dt id="current_water_level">current_water_level</dt>
<dd>
<p>The default water level is to <code>5 unit</code>.</p>
</dd>
<dt id="low_water_level_threshold">low_water_level_threshold</dt>
<dd>
<p>The default threshold is <code>2 unit</code>.</p>
<p>If the current water level is lower than this threshold, then you need to pump water into the tank.</p>
</dd>
<dt id="increase_water_level_by">increase_water_level_by</dt>
<dd>
<p>This is the height of the water level to increase when the water is pumped in.</p>
<p>The default value is <code>0.5 unit</code>.</p>
</dd>
</dl>
<h1 id="WATER-LEVEL-DETECTION-RELATED-METHODS">WATER LEVEL DETECTION RELATED METHODS</h1>
<h2 id="current_water_level-new_water_level">current_water_level ( $new_water_level )</h2>
<p>Sets / returns the current water level of the water.</p>
<p><code>$new_water_level</code> is optional. If present, the current water level will be set to <code>$new_water_level</code>. Otherwise, returns the current water level (depth).</p>
<h2 id="low_water_level_threshold1">low_water_level_threshold</h2>
<p>Returns the low water level threshold.</p>
<h2 id="set_low_water_level_threshold-new_threshold">set_low_water_level_threshold ( $new_threshold )</h2>
<p>Sets the low water level threshold.</p>
<h2 id="is_low_water_level">is_low_water_level</h2>
<p>Returns <code>1</code> if the DO level is less than the threshold value. Otherwise, returns <code>0</code>.</p>
( run in 0.435 second using v1.01-cache-2.11-cpan-b85c58fdc1d )