Perl::...hreads(3pm)
π Perl::Critic::Policy::Community::Threads β the manual page formerly known as Perl::...hreads(3pm) π
okay bestie, welcome to the Perl::Critic::Policy::Community::Threads page. yes the header is giving "my name got cut off in the terminal" β it's Perl::...hreads(3pm) and honestly? iconic of it to be so dramatic. let's get into it. π«Ά
β¨ NAME β¨
Perl::Critic::Policy::Community::Threads β interpreter-based threads are officially discouraged
like, not me being a policy whose whole job is to gently drag interpreter threads. it's not personal, it's just the facts. π
π¦ DESCRIPTION π¦
Perl interpreter threads are officially discouraged. periodt. that's the whole vibe.
the way that they came to exist is that they were created to emulate fork() in Windows environments β which, okay, valid, we needed something. but here's the tea: they are not fast and not lightweight the way one may expect. like, the name said "threads" and you thought "ooooh cute lightweight concurrency" and it's giving... not that. π
so what's a girl to do instead? depends on your code, bestie:
- Non-blocking code or I/O can be easily parallelized by using an event loop such as
POE,IO::Async, orMojo::IOLoop. β¨ - Blocking code is usually better parallelized by forking, which on Unix-like systems is fast and efficient. no cap. πΈ
and if forking sounds scary, don't worry, there's help:
- Modules such as
forksandParallel::Preforkcan make forking easier to work with. π - There are also forking modules for event loops, such as
POE::Wheel::Run,IO::Async::Process, or"subprocess"inMojo::IOLoop. π₯
so like... fork, or event loop, or both, just maybe not interpreter threads, iykyk. π
π AFFILIATION π
This policy is part of Perl::Critic::Community. it's a community thing, we're all fam here. π
π CONFIGURATION π
This policy is not configurable except for the standard options.
that's it. that's the whole config section. she's low maintenance. π
β AUTHOR β
Dan Book, dbook@cpan.org
thank you Dan, legend behavior fr fr. π«Ά
π COPYRIGHT AND LICENSE π
Copyright 2015, Dan Book.
This library is free software; you may redistribute it and/or modify it under the terms of the Artistic License version 2.0.
(so like, go off, remix it, redistribute it, just respect the license bestie π)
πΈ SEE ALSO πΈ
Perl::Critic
and that's the page!! perl v5.40.1, dated 2025-03-22, mwah π β¨ keep your code parallel, keep your threads interpreter-free, and stay slay. π¦π
π¦ where this page comes from
- debian trixie: libperl-critic-community-perl 1.0.4-1 Β· Artistic-2.0
- ubuntu resolute: libperl-critic-community-perl 1.0.4-1 Β· Artistic-2.0
- ubuntu stonking: libperl-critic-community-perl 1.0.4-1 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms