Swatch...eshold(3pm)
π Swatchdog::Threshold π
okay bestie, so this is Swatchdog::Threshold β it's the Perl extension that does the thresholding thing inside swatchdog(1). It lives in the User Contributed Perl Documentation, which is giving "community-made, hand-crafted, artisanal" energy and honestly? we love that for it. π
β¨ SYNOPSIS β¨
here's the vibe when you call it from Perl, copy it exactly bestie:
use Swatchdog::Threshold;
&Swatchdog::threshold( SWID => <int>,
TYPE => <limit|threshold|both>,
TRACK_BY => <key>, # like an IP addr
COUNT => <int>,
SECONDS => <int>
);
πΈ SWATCH SYNTAX πΈ
and here's how you write it inside a swatch config file, no code required:
threshold track_by=<key>,
type=<limit|threshold|both>,
count=<int>,
seconds=<int>
π DESCRIPTION π
okay so let's break it down, no cap:
SWIDβ this is swatchdog's own internal ID number for thewatchforblock. it's the little name tag swatchdog puts on each block so it knows who's who. π·οΈTYPEβ can belimit,threshold, orboth. three flavors, all iconic, here's the tea:Limitβ alerts you on the 1stCOUNTevents during the time interval, and then? it just ignores events for the rest of that time interval. it said "I've said my piece" and went to go lie down. πThresholdβ alerts everyCOUNTtimes we see this event during the time interval. consistent queen. every single time. π₯Bothβ alerts once per time interval after seeingCOUNToccurrences of the event, and then ignores any additional events during that time interval. so it's like β one alert, then silence, then reset. main character energy, minimal drama. β¨
SECONDSβ this is the time interval. the clock. the window. the timeframe in which all this counting happens. β³
fr fr, that's the whole mechanic β you're just telling swatchdog how many times and how long before it should start yelling at you. π
π AUTHOR π
E. Todd Atkins, todd.atkins@stanfordalumni.org β we stan a legend. π«Ά
π¦ SEE ALSO π¦
perl(1), swatchdog(1) β go read those too bestie, they're right there.
k that's the whole page!! this was documented in perl v5.36.0 and dated 2023-01-20, so like β vintage but make it relevant π thanks for reading, mwah π
π
π¦ where this page comes from
- debian bookworm: swatch 3.2.4-5 Β· GPL-2.0-or-later
- debian trixie: swatch 3.2.4-5 Β· GPL-2.0-or-later
- ubuntu noble: swatch 3.2.4-5 Β· GPL-2.0-or-later
- ubuntu questing: swatch 3.2.4-5
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms