NAME
Array::FIFO - Simple FIFO array, with a few convenience methods
VERSION
version 0.03
SYNOPSIS
my $ar = Array::FIFO->new( max_size => 12 );
$ar->add( 20 );
$ar->add( 18 );
$ar->add( 22 );
say $ar->average;
DESCRIPTION
Provides access to doppler data via a Doppler::Storage::Engine package through an interface provided by a Doppler::Storage::Interface role.
METHODS
new
max_size
(optional)-
Numeric value of how large the array is allowd to get. When it reaches max_size, every item added causes the oldest item to be removed.
If no value is passed, there is no max size.
add
$ar->add( 99 );
You can add any type of item to the array; if it's not a number it will just not affect the sum() or average() calculations.
remove
$ar->remove;
Remove the oldest item on the array.
queue
$ar->queue;
Reference directly the fifo array.
size
$ar->size;
How many elements are in the array.
max_size
$ar->max_size;
The maximum size the array is allow to be.
sum
$ar->sum;
The sum of all numeric elements in the array.
average
$ar->average;
The average of all numeric elements in the array.
AUTHOR
Dan Burke dburke at addictmud.org
BUGS
If you encounter any bugs, or have feature requests, please create an issue on github. https://github.com/dwburke/perl-Array-FIFO/issues