Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Module to limit email floods?

by BrowserUk (Patriarch)
on Oct 14, 2010 at 21:46 UTC ( [id://865364]=note: print w/replies, xml ) Need Help??


in reply to Module to limit email floods?

Wrap the sub that sends the alerts in a sub that records and checks for the last time that particular alert was sent, and have it do nothing if it was already sent within some specified period:

use constant INTERVAL => 3600; my %alerts; sub wrapSendSMS{ my( $alert, $no ) = @_; ## Do nothing if we've sent one recently return if exists $alerts{ $alert } and time() - $alerts{ $alert } < INTERVAL; ## Send it and record when sendSMS( $alert, $no ); $alerts{ $alert } = time; return 1; }

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://865364]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2026-04-13 10:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.