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

NAME

Acme::FishFarm::WaterFiltration - Water Filter for Acme::FishFarm

VERSION

Version 1.01

SYNOPSIS

    use 5.010;

    use Acme::FishFarm qw( reduce_precision );
    use Acme::FishFarm::WaterFiltration;

    my $water_filter = Acme::FishFarm::WaterFiltration->install;

    say "Water filter installed and switched on!\n";


    my $current_reading;
    my $waste_count_threshold;
    
    while ( "Fish are living under the water..." ) {
        $water_filter->current_waste_count( reduce_precision ( rand(100) ) );
        
        $current_reading = $water_filter->current_waste_count;
        $waste_threshold = $water_filter->waste_count_threshold;
        
        print "Current Waste Count: ", $current_reading, " (high: >= ", $waste_threshold, ")\n";

        if ( $water_filter->is_cylinder_dirty ) {
            print "  !! Filtering cylinder is dirty!\n";
            print "  Cleaned the filter!\n";
            $water_filter->clean_cylinder;
        } else {
            print "  Filtering cylinder is still clean.\n";
        }
        sleep(1);
        say "";
    }

EXPORT

None

DESCRIPTION

This module assumes a cool water filter with a filtering cylinder constantly filtering water in the tank. It has inlet, outlet and a drainage valves. The drainage valve is only opened when the cleaners are switched on automatically to remove waste from the cylinder. To be honest, those cleaners look more like spatulas to me :)

This feature is based on the water filter found here

CREATION SUBROUTINES/METHODS

install ( %options )

Installs a cool water filtration system.

The following are avaiable for %options:

current_waste_count

The current waste count in the cylinder. Default is 0.

waste_threshold

Default value is 75.

Sets the waste treshold.

This is the maximum limit of waste in the cylinder. When this count is hit, it will turn on the cleaners / spatulas or whatever it's called :).

reduce_waste_count_by

Default is 10.

The amount of waste to remove from the cylinder / filter each time the cleaning process is called.

WASTE LEVEL DETECTING SUBROUTINES/METHODS

current_waste_count ( $new_waste_count )

Sets / returns the current waste count inside the cylinder.

$new_waste_count is optional. If present, the current waste count will be set to $new_waste_count. Otherwise, returns the current waste count.

waste_count_threshold

Returns the waste count threshold.

set_waste_count_threshold

Sets the waste count threshold.

reduce_waste_count_by

Returns the amount of waste to be reduce each time the cleaning process is called.

set_waste_count_to_reduce ( $new_count )

Sets the waste count reduction value to $new_count.

is_filter_layer_dirty

Synonym for is_cylinder_dirty. See next method.

is_cylinder_dirty

Returns 1 if the filtering cylinder is dirty ie current waste count hits the waste count threshold. Returns 0 otherwise.

Remember to clean your cylinder ie. filter layer as soon as possible if it is dirty.

CLEANING RELATED SUBROUTINES/METHODS

clean_filter_layer

Synonym for is_cylinder_dirty. See next method.

clean_cylinder ( $reduce_waste_by )

Cleans the filter layer in the cylinder.

$reduce_waste_by is optional. If present, it will reduce waste by that specific value. Otherwise, it cleans the cylinder completly in one shot ie waste count will be 0.

If $reduce_waste_by is a negative value, it will be turned into a positive value with the same magnitude.

Make sure that you turn on the spatulas, if not this process will not do anything :) See turn_on_spatulas below.

turn_on_spatulas

Activates the cleaning mechanism ie the spatulas :)

Take note that turning on the spatulas does not clean the cylinder. You need to do it explicitly. See clean_cylinder method above for more info :)

turn_off_spatulas

Deactivates the cleaning mechanism ie the spatulas :)

is_on_spatulas

Returns 1 if the spatula are turned on. The spatula will not clean the cylinder until you explicitly tell the system to do so. See clean_cylinder 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::WaterFiltration

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)