NAME
Acme::FishFarm::Feeder - Automated Feeder for Acme::FishFarm
VERSION
Version 1.01
SYNOPSIS
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 :)";
EXPORT
None
CREATION RELATED METHODS
install ( %options )
Installs an automated fish feeder.
The following are available for %options
:
timer
The default is
8
.This is used as a threshold to identify that the time is up to feed the fish or not.
The clock will be set to this value for countdown.
feeding_volume
The default is
50 cm^3
.food_tank_capacity
The maximum volume of fish food. Default is
500 cm^3
.current_food_amount
The initial amount of food to be filled into the food tank. Default is max ie
500 cm^3
.
TIMER RELATED SUBROUTINES/METHODS
get_timer
Returns the timer threshold of the feeder.
set_timer ( $time )
Sets the new timer threshold of the feeder.
Setting this timer will not affect the clock within the feeder.
timer_is_up
Check if the timer is up. If timer is up, please remember to feed your fish. See feed_fish
for more info.
time_remaining
Returns the time remaining to feed the fish.
This method might not be really useful, but anyway :)
tick_clock ( $custom_tick )
$custom_tick
is optional and the default is 1
.
This will cause the timer of the feeder to increase by 1
(default) or by $custom_tick
.
FOOD TANK RELATED SUBROUTINE/METHODS
food_tank_capacity
Returns the current food tank capacity.
set_food_tank_capacity ( $new_capacity )
Set the new food tank capacity to $new_capacity
.
food_remaining
Returns the remaining amount of food left.
FEEDING RELATED SUBROUTINES/METHODS
feed_fish ( %options )
Feeds the fish.
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 timer_is_up
for more info.
%options
supports the following key:
verbose
Setting this to a true value will give output about the feeder's situation when feeding the fish.
set_feeding_volume ( $volume )
Sets the fish food feeding volume.
$volume
must be a positive number. No error checking is done for this yet.
feeding_volume
Returns the amount of food to feed the fish each time the feed_fish
method is called.
refill ( $volume )
Refills the fish food tank TO $volume
.
If $volume
is not specified, the food tank will be filled to max.
If $volume
is a strange value, it will be ignored and filled to max.
AUTHOR
Raphael Jong Jun Jie, <ellednera at cpan.org>
BUGS
Please report any bugs or feature requests to bug-. at rt.cpan.org
, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=.. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Acme::FishFarm::Feeder
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
Besiyata d'shmaya
SEE ALSO
Acme::FishFarm
LICENSE AND COPYRIGHT
This software is Copyright (c) 2021 by Raphael Jong Jun Jie.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)