Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Help with module name

by jdrago_999 (Hermit)
on Nov 20, 2006 at 17:30 UTC ( #585096=perlmeditation: print w/replies, xml ) Need Help??

Monks -

I have written a module I intend to release on CPAN which mimics the JavaScript functions setInterval() and clearInterval().

I have the "forks" version ready, and will also release a "threads" version.

My question is - what do you call this? "Interval" is already taken and means something else. "forks::interval" and "threads::interval" sound nice but I haven't contacted the forks/threads module maintainers yet.

Usage looks like this:
use whatever::Interval; my $interval = whatever::Interval->setInterval( action => \&do_stuff, interval => 1000, # One second ); # "do_stuff()" gets executed once every second. # ...later... $interval->clearInterval();
Thoughts? Ideas? Does this functionality already exist in another module?

Replies are listed 'Best First'.
Re: Help with module name
by ikegami (Pope) on Nov 20, 2006 at 18:03 UTC
Re: Help with module name
by castaway (Parson) on Nov 21, 2006 at 08:09 UTC
    I suggest you look for a name that closer describes what it does, instead of mimicing the javascript name. The purpose wasn't obvious to me at all until I read the comment in the example. Something like Schedule, or Repeat. There are a couple of these on CPAN, see Schedule::Cron for example.


Re: Help with module name
by alpha (Scribe) on Nov 21, 2006 at 07:51 UTC
    Very nice.. Can't find any problems to solve with it though.. But still its' good
Re: Help with module name
by radiantmatrix (Parson) on Nov 22, 2006 at 18:12 UTC

    How about "every"?

    use Every ':threads'; my $process = Every->time( ms => 1000, call => \&do_stuff, args => [] +); $process->start(); #now do_stuff() will get called ever 1000 ms. # .. later... $process->stop();

    This would leave open the future possiblity of event- or condition-driven "Every" processes as well, instead of just time-driven.

    As for the use statement, you could either do a custom import sub (interface like above) or have Every::threads, Every::fork and so on.

    Ramblings and references
    The Code that can be seen is not the true Code
    I haven't found a problem yet that can't be solved by a well-placed trebuchet

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://585096]
Approved by ww
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (8)
As of 2018-06-22 22:02 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (124 votes). Check out past polls.