Acme-FishFarm

 view release on metacpan or  search on metacpan

docs/Acme-FishFarm-OxygenMaintainer-1.01.html  view on Meta::CPAN

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Acme::FishFarm::OxygenMaintainer - Oxygen 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-SUBROUTINES-METHODS">CREATION RELATED SUBROUTINES/METHODS</a>
    <ul>
      <li><a href="#install-options">install ( %options )</a></li>
    </ul>
  </li>
  <li><a href="#DISSOLVED-OXYGEN-SENSOR-RELATED-METHODS">DISSOLVED OXYGEN SENSOR RELATED METHODS</a>
    <ul>
      <li><a href="#current_DO-new_DO">current_DO ( $new_DO )</a></li>
      <li><a href="#DO_threshold1">DO_threshold</a></li>
      <li><a href="#set_DO_threshold-new_DO_threshold">set_DO_threshold ( $new_DO_threshold )</a></li>
      <li><a href="#is_low_DO">is_low_DO</a></li>
    </ul>
  </li>
  <li><a href="#OXYGEN-GENERATING-RELATED-METHODS">OXYGEN GENERATING RELATED METHODS</a>
    <ul>
      <li><a href="#oxygen_generation_volume">oxygen_generation_volume</a></li>
      <li><a href="#set_oxygen_generation_volume-new_rate">set_oxygen_generation_volume ( $new_rate )</a></li>
      <li><a href="#generate_oxygen">generate_oxygen</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::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-&gt;install( DO_generation_volume =&gt; 3 );
    say &quot;Oxygen maintainer installed!\n&quot;;


    while ( &quot;fish are using up oxygen&quot; ) {
        say &quot;Current Oxygen Level: &quot;, $oxygen-&gt;current_DO, &quot; mg/L&quot;,
            &quot; (low: &lt; &quot;, $oxygen-&gt;DO_threshold, &quot;)&quot;;
        #say &quot;Low Oxygen Level: &quot;, $oxygen-&gt;DO_threshold, &quot; mg/L&quot;;

        if ( $oxygen-&gt;is_low_DO ) {
            say &quot;Fish status: Suffocating&quot;;
            say &quot;  !! Low oxygen level!&quot;;
            say &quot;Pumping &quot;, $oxygen-&gt;oxygen_generation_volume, &quot; mg/L of oxygen into the water...&quot; ;
            $oxygen-&gt;generate_oxygen;
        } else {
            say &quot;Fish status: Happy&quot;;
        }
        
        consume_oxygen( $oxygen, rand(2.5) );
        
        sleep(3);
        say &quot;&quot;;
    }</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&#39;t show up if you call any of it&#39;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>



( run in 2.625 seconds using v1.01-cache-2.11-cpan-5c0b1e786e0 )