Munin::...Timeout(3)

πŸ“¦ version 2.0.78, in nixos 26.05, nixpkgs unstable

πŸ’– Munin::...Timeout(3) β€” timeout tea, but make it Perl πŸ’–

okay so bestie, welcome to this User Contributed Perl Documentation page for Munin::...Timeout(3). The module is Munin::Common::Timeout, and its whole vibe is: run code with a timeout, and yes it may nest. no cap. 🫢


✨ NAME ✨

Munin::Common::Timeout β€” run code with a timeout. May nest. ⏳

🌸 SYNOPSIS 🌸

        use Munin::Common::Timeout;

        do_with_timeout(50, sub {
            # ...
               do_with_timeout(5, sub {
                       # ...
                       # ...
               });
            # ...
        });

πŸ¦‹ DESCRIPTION πŸ¦‹

See also Time::Out, Sys::AlarmCall. That's the whole description, bestie β€” short and iconic. πŸ’…

πŸŽ€ SUBROUTINES πŸŽ€

do_with_timeout

my $finished_with_no_timeout = do_with_timeout($seconds, $code_ref)
    or die "Timed out!";

This one executes $block with a timeout of $seconds. It returns the return value of $block if it completed within the timeout. If the timeout is reached and the code is still running, it halts it and returns undef. 😭

NB: every $code_ref should return something defined, otherwise the caller doesn't know if a timeout occurred. 🚨

Calls to do_with_timeout() can be nested. Any exceptions raised by $block are propagated. ✨


okay bye bestie, this page is from perl v5.42.3, dated 1980-01-01, and it's the Munin::...Timeout(3) manual page. slay πŸ’…πŸ’–

πŸ“¦ where this page comes from