Acme-FishFarm
view release on metacpan or search on metacpan
lib/Acme/FishFarm/WaterFiltration.pm view on Meta::CPAN
=head1 EXPORT
None
=head1 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 L<here|https://www.filternox.com/filters/spt-wbv-mr/>
=head1 CREATION SUBROUTINES/METHODS
=head2 install ( %options )
Installs a cool water filtration system.
The following are avaiable for C<%options>:
=over 4
=item current_waste_count
The current waste count in the cylinder. Default is C<0>.
=item waste_threshold
Default value is C<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 :).
=item reduce_waste_count_by
Default is C<10>.
The amount of waste to remove from the cylinder / filter each time the cleaning process is called.
=back
=cut
sub install {
my $class = shift;
my %options = @_;
if ( not $options{current_waste_count} ) {
$options{current_waste_count} = 0;
}
if ( not $options{waste_threshold} ) {
$options{waste_threshold} = 75;
}
$options{is_on_spatulas} = 0;
$options{reduce_waste_count_by} = 10;
bless \%options, "Acme::FishFarm::WaterFiltration";
}
=head1 WASTE LEVEL DETECTING SUBROUTINES/METHODS
=head2 current_waste_count ( $new_waste_count )
Sets / returns the current waste count inside the cylinder.
C<$new_waste_count> is optional. If present, the current waste count will be set to C<$new_waste_count>. Otherwise, returns the current waste count.
=cut
sub current_waste_count {
ref( my $self = shift ) or croak "Please use this the OO way";
if ( @_ ) {
$self->{current_waste_count} = shift;
} else {
$self->{current_waste_count};
}
}
=head2 waste_count_threshold
Returns the waste count threshold.
=cut
sub waste_count_threshold {
ref( my $self = shift ) or croak "Please use this the OO way";
$self->{waste_threshold};
}
=head2 set_waste_count_threshold
Sets the waste count threshold.
=cut
sub set_waste_count_threshold {
ref( my $self = shift ) or croak "Please use this the OO way";
$self->{waste_threshold} = shift;
}
=head2 reduce_waste_count_by
Returns the amount of waste to be reduce each time the cleaning process is called.
=cut
sub reduce_waste_count_by {
ref( my $self = shift ) or croak "Please use this the OO way";
$self->{reduce_waste_count_by};
}
=head2 set_waste_count_to_reduce ( $new_count )
Sets the waste count reduction value to C<$new_count>.
( run in 1.989 second using v1.01-cache-2.11-cpan-ceb78f64989 )