Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Data::Delta module proposal

by VGavara (Novice)
on Jul 31, 2013 at 11:58 UTC ( #1047242=perlmeditation: print w/ replies, xml ) Need Help??

Hi all guardians of Perl wisdom. This is my very first post at the Monastery, though not so new programing in Perl.

Due to my continuous relation with processing SNMP counter values (those who grow until overflowing and then start again from zero) I've noticed that there's any Perl module (or I'm unable to find it at CPAN) for dealing with this kind of data that I freely name deltas: the difference between two numeric values in time considering the fact that they can overflow.

Following the tachyon's "How to make a CPAN Module Distribution" advices, I submit the question to you before trying to upload it to the module repository: Does exist a module that deals with this kind of processing? If not, is Data::Delta a right name or might be named in other way?

Many thanks in advance.

Comment on Data::Delta module proposal
Re: Data::Delta module proposal
by MidLifeXis (Prior) on Jul 31, 2013 at 12:52 UTC

    From your description, it seems like something along the lines of Counter::Rolloverable would more accurately describe the module, but that name is awful. Perhaps SNMP::Counter::Delta? Or SNMP::Counter with a delta method? Another idea would be SNMP::DataType::Counter::Util. Not being versed in SNMP more than "what does SNMP stand for?", I would also ask if the term Counter is the correct term in the SNMP domain.

    --MidLifeXis

      The fact is that the library can be used in other environments different to those where data comes from a SNMP agent, that why I avoid using SNMP in the name proposal.

      For instance, imagine a access control system counting the number of visitors to a given building and storing it in a text file (for instance). You could use the library for easily calculating how many users per hour are accessing.

Re: Data::Delta module proposal
by tobyink (Abbot) on Jul 31, 2013 at 13:06 UTC

    Almost every module that starts with "Data::" is poorly named.

    package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name

      Absolutely, maybe because of the abstract nature of the data concept.

        Data::Dumper is a case in point. It's a dumper for Perl variables, not data more generally. Can it be used as a drop-in replacement for PostgreSQL's pg_dump command? Not without loading that data into Perl variables first. Calling it "Variable::Dumper" would have been more descriptive.

        Data::Dumper isn't an absolutely awful name for what it does, but there are better names that could have been chosen. Virtually all modules deal with data in some way; that doesn't mean that virtually all modules should sit in the Data:: namespace.

        package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name
Re: Data::Delta module proposal
by DrHyde (Prior) on Aug 01, 2013 at 10:13 UTC

    Data::Delta is a terrible name.

    If we assume a 16 bit counter (because I can't remember off the top of my head what 2^32 or 2^64 are in denary), then you want the delta between 65535 and 0 to be 1. However, for most other people, they'd want the delta to be 65535 (or, perhaps depending on the order of the arguments, -65535). You need to include the word "Rollover" in the name.

      Yes, in fact it works as you define. Then... this is like choosing the name for a son, seems more difficult than creating the module itself... might it be named as Data::Delta::Rollover or Data::Counter::Rollover?

      Personally Data::Delta::Rollover seems to match better for me since the module calculates deltas supporting the fact that they can rollover. On the other hand it does it from counters, so it's not foolish to reflect it in the name... Oh, seekers of supreme wisdom, I really need advice.

Re: Data::Delta module proposal (prepan)
by Anonymous Monk on Aug 01, 2013 at 11:07 UTC
Re: Data::Delta module proposal
by VGavara (Novice) on Aug 03, 2013 at 08:50 UTC

    I've found Data::Perl::Counter where Matthew Phillips considers a counter as a value able of both incrementing and decrementing, what seem quite logical now (my initial point of view was that a counter always increased). I'm trying to contact with Mathew in order to know his opinion about of adding the new module to the current structure (something like Data::Perl::Counter::Delta) and make it compatible with his counter class.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://1047242]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (12)
As of 2014-12-26 15:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (171 votes), past polls