Specific(3pm)
β¨ NAME β¨
Coro::Specific β the lil module that manages coroutine-specific variables π (it's Specific(3pm) bestie, a Perl thing, user-contributed, and yes she's iconic)
πΈ SYNOPSIS πΈ
use Coro::Specific;
my $ref = new Coro::Specific;
$$ref = 5;
print $$ref;
like... that's it. that's the whole vibe. π«Ά
π DESCRIPTION π
okay so this module lets you make variables (or, honestly, better: references to them) that are specific to whichever coroutine is currently executing. main character variables. they only exist for their coro. periodt. β¨
one thing though β this module does not automatically load the Coro module, and that's on purpose: it means the overhead stays small when no coroutines are being used at all. efficiency queen. π
ngl, there's a much faster method: just store extra keys into %$Coro::current. all you gotta do is make sure the key is unique β like, prefix it with your module name or whatever, keep it distinctive. and the wild part? you can even store data in there before loading the Coro module. when Coro gets loaded, the keys stored in %$Coro::current are automatically attached to the coro thread that's executing the main program. no cap. π
also you don't have to load "Coro::Specific" manually, bestie β it gets loaded automatically when you "use Coro" and call the "new" constructor. it just shows up. main character energy fr fr. π¦
new Create a new coroutine-specific scalar and return a reference to it. The scalar is guaranteed to be "undef". Once such a scalar has been allocated you cannot deallocate it (yet), so allocate only when you must.
so like... that last bit? it's giving "no takebacks." allocate only when you must, okay?? π
π BUGS π
The actual coroutine specific values do not automatically get destroyed when the Coro::Specific object gets destroyed.
yes this is real and yes it's as unhinged as it sounds. the object dips, the values stay. they're just... there. living rent free. π
π AUTHOR/SUPPORT/CONTACT π
Marc A. Lehmann <schmorp@schmorp.de>
http://software.schmorp.de/pkg/Coro.html
and that's the whole page babes π this was Specific(3pm) from the Coro era, perl v5.40.1, dated 2025-03-21 β shoutout to Marc A. Lehmann for writing her, and to the Perl docs for keeping her safe all this time. slay, stay coroutine-specific, and hydrate. πβ¨
π¦ where this page comes from
- debian trixie: libcoro-perl 6.570-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcoro-perl 6.570-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms