NAME
Data::Average - Hold Data Set To Calculate Average
SYNOPSIS
use Data::Average::Expires;
my $data = Data::Average::Expires->new(expires_in => 10);
$data->add($_) for (1..100);
print $data->avg; # 55
# sleep for more than 10 seconds...
sleep(15);
print $data->length; # 0
$data->add(Data::Average::Expires::Item->new(expires_in => 60, value => 200));
DESCRIPTION
Data::Average::Expires only takes into account values that haven't expired: for example, you can track the average value of something for the last 10 minutes using this module.
METHODS
new(expires_in => $expires_in)
Creates a new Data::Average object, with default expire time set to the value denoted by $expires_in
add($value)
Adds a value to the Data::Average::Expires set.
$value may be a scalar or a Data::Average::Expires::Item object. Items are always checked for expiry before each operation.
length()
avg()
Same as Data::Average.
AUTHOR
Copyright (c) 2006 Daisuke Maki <dmaki@cpan.org> All rights reserved.