Acme::FishFarm::Feeder - Automated Feeder for Acme::FishFarm

- NAME
- VERSION
- SYNOPSIS
- EXPORT
- CREATION RELATED SUBROUTINES/METHODS
  - install ( %options )
- TIMER RELATED SUBROUTINES/METHODS
  - get_timer
  - set_timer ( $hours )
  - timer_is_up
  - time_remaining
  - tick_clock ( $custom_tick )
- FOOD TANK RELATED SUBROUTINE/METHODS
  - food_tank_capacity
  - set_food_tank_capacity ( $new_capacity )
  - food_remaining
- FEEDING RELATED SUBROUTINES/METHODS
  - feed_fish ( %options )
  - set_feeding_volume ( $volume )
  - feeding_volume
  - refill ( $volume )
- AUTHOR
- BUGS
- SUPPORT
- ACKNOWLEDGEMENTS
- LICENSE AND COPYRIGHT

# NAME

Acme::FishFarm::Feeder - Automated Feeder for Acme::FishFarm

# VERSION

Version 1.00

# 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 (1) {
        for (0..20){

            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 by default

# CREATION RELATED SUBROUTINES/METHODS

## install ( %options )

Installs an automated fish feeder.

The following are available for `%options`:

- timer

  The default is 8 hours.

  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 ( $hours )

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` hour.

This will cause the timer of the feeder to increase by `1` hour (default) or by `$custom_tick` hours.

# FOOD TANK RELATED SUBROUTINE/METHODS

## food_tank_capacity

Returns the current food tank capacity in `cm^3`.

## set_food_tank_capacity ( $new_capacity )

Set the new food tank capacity to `$new_capacity`.

## food_remaining

Checks the remaining of food left in `cm^3`.

# FEEDING RELATED SUBROUTINES/METHODS

## feed_fish ( %options )

Feeds the fish. This will cause the `current_food_amount` to become less.

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` support the following:

- 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 feeding volume for the fish.

`$volume` must be a positive number. No error checking is done for this yet.

## feeding_volume

Returns the amount of food in `cm^3` to feed the fish each time.

## refill ( $volume )

Refills the fish food tank TO `$volume cm^3`.

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)

  https://rt.cpan.org/NoAuth/Bugs.html?Dist=.

- CPAN Ratings

  https://cpanratings.perl.org/d/.

- Search CPAN

  https://metacpan.org/release/.

# 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)