Acme::FishFarm::OxygenMaintainer - Oxygen Maintainer for Acme::FishFarm
Version 1.01
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 "";
}
None
Installs an oxygen maintainer system.
The supported %options
are:
The default DO is to 8 mg/L
.
The default threshold is 5 mg/L
.
If the current DO level is lower than this threshold, then your fish is lacking oxygen.
This is the rate of oxygen generation.
The default value is 0.2 mg/L per unit time
The unit mg/L
is just a unit, it doesn't show up if you call any of it's related getters.
Sets / returns the current DO level of the water.
$new_DO
is optional. If present, the current DO will be set to $new_DO
. Otherwise, returns the current DO reading.
Returns the DO threshold.
Sets the DO threshold.
Returns 1
if the DO level is less than the threshold value. Otherwise, returns 0
.
Returns the oxygen generation rate.
Sets the new oxygen generation rate to $new_rate
.
Pumps oxygen into the water based on the diffusion rate. The current DO value will increase every time this action is invoked.
Take note that this will generate oxygen no matter what. Make sure you check the DO content before pumping oxygen into your tank. See is_low_DO
method above for more info.
Raphael Jong Jun Jie, <ellednera at cpan.org>
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.
You can find documentation for this module with the perldoc command.
perldoc Acme::FishFarm::OxygenMaintainer
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
CPAN Ratings
Search CPAN
Besiyata d'shmaya
This software is Copyright (c) 2021 by Raphael Jong Jun Jie.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)