Acme-FishFarm
view release on metacpan or search on metacpan
docs/Acme-FishFarm-OxygenMaintainer-1.01.html view on Meta::CPAN
<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::OxygenMaintainer - Oxygen 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(consume_oxygen reduce_precision);
use Acme::FishFarm::OxygenMaintainer;
my $oxygen = Acme::FishFarm::OxygenMaintainer->install( DO_generation_volume => 3 );
say "Oxygen maintainer installed!\n";
while ( "fish are using up oxygen" ) {
say "Current Oxygen Level: ", $oxygen->current_DO, " mg/L",
" (low: < ", $oxygen->DO_threshold, ")";
#say "Low Oxygen Level: ", $oxygen->DO_threshold, " mg/L";
if ( $oxygen->is_low_DO ) {
say "Fish status: Suffocating";
say " !! Low oxygen level!";
say "Pumping ", $oxygen->oxygen_generation_volume, " mg/L of oxygen into the water..." ;
$oxygen->generate_oxygen;
} else {
say "Fish status: Happy";
}
consume_oxygen( $oxygen, rand(2.5) );
sleep(3);
say "";
}</code></pre>
<h1 id="EXPORT">EXPORT</h1>
<p>None</p>
<h1 id="CREATION-RELATED-SUBROUTINES-METHODS">CREATION RELATED SUBROUTINES/METHODS</h1>
<h2 id="install-options">install ( %options )</h2>
<p>Installs an oxygen maintainer system.</p>
<p>The supported <code>%options</code> are:</p>
<dl>
<dt id="current_DO">current_DO</dt>
<dd>
<p>The default DO is to <code>8 mg/L</code>.</p>
</dd>
<dt id="DO_threshold">DO_threshold</dt>
<dd>
<p>The default threshold is <code>5 mg/L</code>.</p>
<p>If the current DO level is lower than this threshold, then your fish is lacking oxygen.</p>
</dd>
<dt id="DO_generation_volume">DO_generation_volume</dt>
<dd>
<p>This is the rate of oxygen generation.</p>
<p>The default value is <code>0.2 mg/L per unit time</code></p>
</dd>
</dl>
<p>The unit <code>mg/L</code> is just a unit, it doesn't show up if you call any of it's related getters.</p>
<h1 id="DISSOLVED-OXYGEN-SENSOR-RELATED-METHODS">DISSOLVED OXYGEN SENSOR RELATED METHODS</h1>
<h2 id="current_DO-new_DO">current_DO ( $new_DO )</h2>
<p>Sets / returns the current DO level of the water.</p>
<p><code>$new_DO</code> is optional. If present, the current DO will be set to <code>$new_DO</code>. Otherwise, returns the current DO reading.</p>
<h2 id="DO_threshold1">DO_threshold</h2>
<p>Returns the DO threshold.</p>
<h2 id="set_DO_threshold-new_DO_threshold">set_DO_threshold ( $new_DO_threshold )</h2>
<p>Sets the DO threshold.</p>
<h2 id="is_low_DO">is_low_DO</h2>
<p>Returns <code>1</code> if the DO level is less than the threshold value. Otherwise, returns <code>0</code>.</p>
<h1 id="OXYGEN-GENERATING-RELATED-METHODS">OXYGEN GENERATING RELATED METHODS</h1>
<h2 id="oxygen_generation_volume">oxygen_generation_volume</h2>
<p>Returns the oxygen generation rate.</p>
<h2 id="set_oxygen_generation_volume-new_rate">set_oxygen_generation_volume ( $new_rate )</h2>
<p>Sets the new oxygen generation rate to <code>$new_rate</code>.</p>
<h2 id="generate_oxygen">generate_oxygen</h2>
<p>Pumps oxygen into the water based on the diffusion rate. The current DO value will increase every time this action is invoked.</p>
<p>Take note that this will generate oxygen no matter what. Make sure you check the DO content before pumping oxygen into your tank. See <code>is_low_DO</code> method above for more info.</p>
<h1 id="AUTHOR">AUTHOR</h1>
<p>Raphael Jong Jun Jie, <code><ellednera at cpan.org></code></p>
<h1 id="BUGS">BUGS</h1>
<p>Please report any bugs or feature requests to <code>bug-. at rt.cpan.org</code>, or through the web interface at <a href="https://rt.cpan.org/NoAuth/ReportBug.html?Queue=.">https://rt.cpan.org/NoAuth/ReportBug.html?Queue=.</a>. I will be notified,...
<h1 id="SUPPORT">SUPPORT</h1>
<p>You can find documentation for this module with the perldoc command.</p>
<pre><code> perldoc Acme::FishFarm::OxygenMaintainer</code></pre>
<p>You can also look for information at:</p>
<ul>
( run in 0.814 second using v1.01-cache-2.11-cpan-39bf76dae61 )