in reply to RFC: Time Lock Module Idea?
I like the idea, definitely. I get swamped with pages/error emails/you name it on occasion, and would love a good solution to that problem. I was actually a bit surprised I couldn't find anything on CPAN that already does this, so yes, please, build this *now* :)
As for the name, TimeLock doesn't really explain what it does. I'm not really good with names, but maybe something like "Sub::Deferred" would be clearer.
I feel your interface is too verbose, and interferes with the flow of the code. I would recommend an interface like Memoize, in that you "defer" a function or method somewhere at the top of your script, while the rest of your code stays as is:
use Sub::Deferred store => '/tmp/foo_timelock'; defer( 'page_me', 600 ); # ... if( something_really_bad() ) { my $message = "Something Really Bad just happened..."; page_me( $message ); # run only once every 600 seconds }
This way you could add it to existing scripts without having to go through a lot of code. And it's very easy to disable too.
It would probably be quite easy to decide to defer a subroutine based on its input parameters. Strategies and settings could be specified in the call to defer().
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: RFC: Time Lock Module Idea?
by pileofrogs (Priest) on Mar 24, 2006 at 21:21 UTC | |
by diotalevi (Canon) on Mar 24, 2006 at 21:33 UTC |