NAME
Data::Average::Bounded - Data::Average With Bounded
SYNOPSIS
use Data::Average::Bounded;
my $data = Data::Average::Bounded->new(max => 10);
$data->add($_) for (1..100);
print $data->avg; # 95 (avg of 90 .. 100)
DESCRIPTION
Data::Average::Bounded is a bounded version of Data::Average, which keeps the data size to a predefined size.
METHODS
new(max => $max)
Creates a new Data::Average::Bounded object, bounded by $max.
add($value)
Adds a value to the Data::Average::Bounded set. If the data size exceeds the length specified by 'max' given to the constructor, old elements are popped out of the set to keep the data size.
$value may either be an object that implements a method 'value()' which returns a numerical representation of the object, or a simple scalar.
length()
avg()
Same as Data::Average.
AUTHOR
Copyright (c) 2006 Daisuke Maki <dmaki@cpan.org> All rights reserved.