GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  DATA::AVERAGE::EXPIRES (3)

.ds Aq ’

NAME

Data::Average::Expires - Hold Data Set To Calculate Average

CONTENTS

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 => CW$expires_in)

Creates a new Data::Average object, with default expire time set to the value denoted by $expires_in

    expire_items

Expires items.

    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.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 DATA::AVERAGE::EXPIRES (3) 2007-11-14

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.