Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

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
[TStanley]: I'm sitting in the airport in Tampa, Florida at the moment, getting ready to head home.
[talexb]: TStanley I'm flying to Vegas in two weeks time. After that flights leaving Vegas and Phoenix are late at night .. I've been hearing that it gets so hot that the air isn't dense enough for planes to take off. Weird. Guess you won't have that problem.

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2017-06-23 14:13 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (548 votes). Check out past polls.