Acme-FishFarm
view release on metacpan or search on metacpan
docs/Acme-FishFarm-Feeder-1.01.html view on Meta::CPAN
<?xml version="1.0" ?>
<!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::Feeder - Automated Feeder 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-METHODS">CREATION RELATED METHODS</a>
<ul>
<li><a href="#install-options">install ( %options )</a></li>
</ul>
</li>
<li><a href="#TIMER-RELATED-SUBROUTINES-METHODS">TIMER RELATED SUBROUTINES/METHODS</a>
<ul>
<li><a href="#get_timer">get_timer</a></li>
<li><a href="#set_timer-time">set_timer ( $time )</a></li>
<li><a href="#timer_is_up">timer_is_up</a></li>
<li><a href="#time_remaining">time_remaining</a></li>
<li><a href="#tick_clock-custom_tick">tick_clock ( $custom_tick )</a></li>
</ul>
</li>
<li><a href="#FOOD-TANK-RELATED-SUBROUTINE-METHODS">FOOD TANK RELATED SUBROUTINE/METHODS</a>
<ul>
<li><a href="#food_tank_capacity">food_tank_capacity</a></li>
<li><a href="#set_food_tank_capacity-new_capacity">set_food_tank_capacity ( $new_capacity )</a></li>
<li><a href="#food_remaining">food_remaining</a></li>
</ul>
</li>
<li><a href="#FEEDING-RELATED-SUBROUTINES-METHODS">FEEDING RELATED SUBROUTINES/METHODS</a>
<ul>
<li><a href="#feed_fish-options">feed_fish ( %options )</a></li>
<li><a href="#set_feeding_volume-volume">set_feeding_volume ( $volume )</a></li>
<li><a href="#feeding_volume">feeding_volume</a></li>
<li><a href="#refill-volume">refill ( $volume )</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="#SEE-ALSO">SEE ALSO</a></li>
<li><a href="#LICENSE-AND-COPYRIGHT">LICENSE AND COPYRIGHT</a></li>
</ul>
<h1 id="NAME">NAME</h1>
<p>Acme::FishFarm::Feeder - Automated Feeder 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::Feeder;
my $feeder = Acme::FishFarm::Feeder->install( timer => 3, feeding_volume => 150 );
say "Feeder installed and switched on!";
say "";
while ( "fish are living happilly" ) {
if ( $feeder->timer_is_up ) {
say "\nTimer is up, time to feed the fish!";
say "Feeding ", $feeder->feeding_volume, " cm^3 of fish food to the fish...";
$feeder->feed_fish;
say $feeder->food_remaining, " cm^3 of fish food remaining in the tank.\n";
}
if ( $feeder->food_remaining <= 0 ) {
$feeder->refill; # default back to 500 cm^3
say "Refilled food tank back to ", $feeder->food_tank_capacity, " cm^3.\n";
}
say $feeder->time_remaining, " hours left until it's time to feed the fish.";
sleep(1);
$feeder->tick_clock;
}
say "";
say "Feeder was switched off, please remeber to feed your fish on time :)";</code></pre>
<h1 id="EXPORT">EXPORT</h1>
<p>None</p>
<h1 id="CREATION-RELATED-METHODS">CREATION RELATED METHODS</h1>
<h2 id="install-options">install ( %options )</h2>
<p>Installs an automated fish feeder.</p>
<p>The following are available for <code>%options</code>:</p>
<ul>
<li><p>timer</p>
<p>The default is <code>8</code>.</p>
<p>This is used as a threshold to identify that the time is up to feed the fish or not.</p>
<p>The clock will be set to this value for countdown.</p>
</li>
<li><p>feeding_volume</p>
<p>The default is <code>50 cm^3</code>.</p>
</li>
<li><p>food_tank_capacity</p>
<p>The maximum volume of fish food. Default is <code>500 cm^3</code>.</p>
</li>
<li><p>current_food_amount</p>
<p>The initial amount of food to be filled into the food tank. Default is max ie <code>500 cm^3</code>.</p>
</li>
</ul>
<h1 id="TIMER-RELATED-SUBROUTINES-METHODS">TIMER RELATED SUBROUTINES/METHODS</h1>
<h2 id="get_timer">get_timer</h2>
<p>Returns the timer threshold of the feeder.</p>
<h2 id="set_timer-time">set_timer ( $time )</h2>
<p>Sets the new timer threshold of the feeder.</p>
<p>Setting this timer will not affect the clock within the feeder.</p>
<h2 id="timer_is_up">timer_is_up</h2>
<p>Check if the timer is up. If timer is up, please remember to feed your fish. See <code>feed_fish</code> for more info.</p>
<h2 id="time_remaining">time_remaining</h2>
<p>Returns the time remaining to feed the fish.</p>
<p>This method might not be really useful, but anyway :)</p>
<h2 id="tick_clock-custom_tick">tick_clock ( $custom_tick )</h2>
<p><code>$custom_tick</code> is optional and the default is <code>1</code>.</p>
<p>This will cause the timer of the feeder to increase by <code>1</code> (default) or by <code>$custom_tick</code>.</p>
<h1 id="FOOD-TANK-RELATED-SUBROUTINE-METHODS">FOOD TANK RELATED SUBROUTINE/METHODS</h1>
<h2 id="food_tank_capacity">food_tank_capacity</h2>
<p>Returns the current food tank capacity.</p>
<h2 id="set_food_tank_capacity-new_capacity">set_food_tank_capacity ( $new_capacity )</h2>
<p>Set the new food tank capacity to <code>$new_capacity</code>.</p>
<h2 id="food_remaining">food_remaining</h2>
<p>Returns the remaining amount of food left.</p>
<h1 id="FEEDING-RELATED-SUBROUTINES-METHODS">FEEDING RELATED SUBROUTINES/METHODS</h1>
<h2 id="feed_fish-options">feed_fish ( %options )</h2>
<p>Feeds the fish.</p>
<p>Take note that this will feed the fish no matter what. So it's up to you to make sure that you check if the feeder timer is really up or not before calling this method. See <code>timer_is_up</code> for more info.</p>
<p><code>%options</code> supports the following key:</p>
<ul>
<li><p>verbose</p>
<p>Setting this to a true value will give output about the feeder's situation when feeding the fish.</p>
</li>
</ul>
<h2 id="set_feeding_volume-volume">set_feeding_volume ( $volume )</h2>
<p>Sets the fish food feeding volume.</p>
<p><code>$volume</code> must be a positive number. No error checking is done for this yet.</p>
<h2 id="feeding_volume">feeding_volume</h2>
<p>Returns the amount of food to feed the fish each time the <code>feed_fish</code> method is called.</p>
<h2 id="refill-volume">refill ( $volume )</h2>
<p>Refills the fish food tank <b>TO</b> <code>$volume</code>.</p>
<p>If <code>$volume</code> is not specified, the food tank will be filled to max.</p>
<p>If <code>$volume</code> is a strange value, it will be ignored and filled to max.</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::Feeder</code></pre>
<p>You can also look for information at:</p>
<ul>
<li><p>RT: CPAN's request tracker (report bugs here)</p>
<p><a href="https://rt.cpan.org/NoAuth/Bugs.html?Dist=.">https://rt.cpan.org/NoAuth/Bugs.html?Dist=.</a></p>
</li>
<li><p>CPAN Ratings</p>
<p><a href="https://cpanratings.perl.org/d/.">https://cpanratings.perl.org/d/.</a></p>
</li>
<li><p>Search CPAN</p>
( run in 2.033 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )