Swatch::Threshold(3)

πŸ“¦
version 3.2.3 Β· 3 versions
, in epel 9

πŸŽ€ Swatch::Threshold(3) β€” bestie, let's talk thresholds πŸŽ€

Okay so this is the manual page for Swatch::Threshold, a Perl extension that does the thresholding thing for swatch(1). It's short, it's sweet, it's iconic. Let's get into it πŸ’…


✨ NAME ✨

Swatch::Threshold β€” a Perl extension for thresholding in swatch(1). That's the whole vibe. That's what we're doing here 🫢


🌸 SYNOPSIS 🌸

Like, here's how you actually call it:

use Swatch::Threshold;

&Swatch::threshold(   SWID => <int>,
                      TYPE => <limit|threshold|both>,
                      TRACK_BY => <key>, # like an IP addr
                      COUNT => <int>,
                      SECONDS => <int>
                      );

No cap, that's the whole call. Every one of those keys matters, bestie β€” don't skip any πŸ™ˆ


πŸ¦‹ SWATCH SYNTAX πŸ¦‹

And this is how it looks when you're writing it in swatch config land instead of Perl land:

threshold track_by=<key>,
   type=<limit|threshold|both>,
   count=<int>,
   seconds=<int>

Same info, different outfit. Slay πŸ’–


πŸ”₯ DESCRIPTION πŸ”₯

Okay so let's break down the pieces, because this is where the actual lore lives:

  • SWID β€” this is swatch's internal ID number for the watchfor block. Like its little government name, iykyk πŸ‘‘
  • TYPE β€” can be limit, threshold, or both. Three options, three whole personalities:
    • Limit β€” alert on the 1st COUNT events during the time interval, then ignore events for the rest of the time interval. Basically it says its piece once and then goes quiet until the clock resets πŸ’€
    • Threshold β€” alert every COUNT times we see this event during the time interval. Consistent. Reliable. Shows up every time πŸ’…
    • Both β€” alert once per time interval after seeing COUNT occurrences of the event, then ignore any additional events during the time interval. It's giving "I'll acknowledge you once, and then I'm done" energy πŸŽ€
  • SECONDS β€” this is the time interval. That's the window. That's the whole clock situation ⭐
Fr fr, the three TYPE values are genuinely different behaviours β€” don't just pick one because it sounds cute. Read what each one actually does first, bestie 🫢

πŸ’œ AUTHOR πŸ’œ

E. Todd Atkins, todd.atkins@stanfordalumni.org. We love a credited author, periodt 🌈


🌟 SEE ALSO 🌟

Both linked in the original, both linked here, no gatekeeping πŸ™Œ


And that's the page, bestie πŸ¦‹ Signing off with the deets from the bottom: this one's from perl v5.32.1, dated 2022-01-22, and it's the Swatch::Threshold(3) page. Go forth and threshold responsibly πŸ’–βœ¨

πŸ“¦ where this page comes from