Acme-FishFarm

 view release on metacpan or  search on metacpan

lib/Acme/FishFarm/Feeder.pm  view on Meta::CPAN

}

=head2 set_feeding_volume ( $volume )

Sets the fish food feeding volume.

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

=cut

sub set_feeding_volume {
    ref (my $self = shift) or croak "Please use this the OO way";
    my $volume = shift or croak "Please specify feeding volume";
    $self->{feeding_volume} = $volume;
}

=head2 feeding_volume

Returns the amount of food to feed the fish each time the C<feed_fish> method is called.

=cut

sub feeding_volume {
    ref (my $self = shift) or croak "Please use this the OO way";
    $self->{feeding_volume};
}

=head2 refill ( $volume )

Refills the fish food tank B<TO> C<$volume>.

If C<$volume> is not specified, the food tank will be filled to max.

If C<$volume> is a strange value, it will be ignored and filled to max.

=cut

sub refill {
    no warnings "numeric";
    ref (my $self = shift) or croak "Please use this the OO way";

    my $volume = shift || $self->{food_tank_capacity};
    return if not int($volume);
    
    if ( $volume > $self->{food_tank_capacity} ) {
        $self->{current_food_amount} = $self->{food_tank_capacity};
    } else {
        $self->{current_food_amount} = $volume;
    }
    
}

=head1 AUTHOR

Raphael Jong Jun Jie, C<< <ellednera at cpan.org> >>

=head1 BUGS

Please report any bugs or feature requests to C<bug-. at rt.cpan.org>, or through
the web interface at L<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.




=head1 SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Acme::FishFarm::Feeder


You can also look for information at:

=over 4

=item * RT: CPAN's request tracker (report bugs here)

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

=item * CPAN Ratings

L<https://cpanratings.perl.org/d/.>

=item * Search CPAN

L<https://metacpan.org/release/.>

=back


=head1 ACKNOWLEDGEMENTS

Besiyata d'shmaya

=head1 SEE ALSO

    Acme::FishFarm

=head1 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)


=cut

1; # End of Acme::FishFarm::Feeder



( run in 0.811 second using v1.01-cache-2.11-cpan-5511b514fd6 )