The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Acme::FishFarm::OxygenMaintainer - Oxygen Maintainer for Acme::FishFarm

VERSION

Version 1.01

SYNOPSIS

    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 "";
    }

EXPORT

None

CREATION RELATED SUBROUTINES/METHODS

install ( %options )

Installs an oxygen maintainer system.

The supported %options are:

current_DO

The default DO is to 8 mg/L.

DO_threshold

The default threshold is 5 mg/L.

If the current DO level is lower than this threshold, then your fish is lacking oxygen.

DO_generation_volume

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.

DISSOLVED OXYGEN SENSOR RELATED METHODS

current_DO ( $new_DO )

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.

DO_threshold

Returns the DO threshold.

set_DO_threshold ( $new_DO_threshold )

Sets the DO threshold.

is_low_DO

Returns 1 if the DO level is less than the threshold value. Otherwise, returns 0.

OXYGEN GENERATING RELATED METHODS

oxygen_generation_volume

Returns the oxygen generation rate.

set_oxygen_generation_volume ( $new_rate )

Sets the new oxygen generation rate to $new_rate.

generate_oxygen

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.

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::OxygenMaintainer

You can also look for information at:

ACKNOWLEDGEMENTS

Besiyata d'shmaya

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)