Perl::...Imports(3pm)
β¨ NAME β¨
Okay bestie, welcome to Perl::Critic::Policy::Community::POSIXImports (yeah that's a mouthful, it's a 3pm manual page, we move) β and the whole entire point of this policy is: don't use POSIX without specifying an import list. That's it. That's the tea. π«
πΈ DESCRIPTION πΈ
So here's the situation, and it's giving chaos. The POSIX module imports hundreds of symbols (functions and constants, like, so many) by default β and it only does that for backwards compatibility reasons. Which, okay, iconic of it, but also lowkey a mess.
To avoid all that, and to help you actually figure out where functions got imported from, you should specify the symbols you want to import explicitly in the use statement. Periodt.
Alternatively β and this is the pro move β you can specify an empty import list with use POSIX () to avoid importing any symbols at all, and then just fully qualify your functions or constants, like POSIX::strftime. Clean. Tidy. Main character energy. π
use POSIX; # not ok
use POSIX (); # ok
use POSIX 'fcntl'; # ok
use POSIX qw(O_APPEND O_CREAT O_EXCL O_RDONLY O_RDWR O_WRONLY); # ok
Notice how the first one is # not ok? Yeah. That's the whole vibe check and it failed. π The other three ate. π
π¦ AFFILIATION π¦
This policy is part of Perl::Critic::Community. She runs with a crew, iykyk. π
π CONFIGURATION π
Bestie, this policy is not configurable β except for the standard options. So no knobs to twist, no settings to fiddle with. It is what it is and it's obsessed with being exactly that. β¨
π AUTHOR π
Dan Book, dbook@cpan.org β shoutout to the author, absolute legend, we stan. π«Ά
π 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.
β SEE ALSO β
Perl::Critic
And that's the whole page, bestie! π This manual came from the User Contributed Perl Documentation, version perl v5.40.1, dated 2025-03-22 β so go forth, specify your imports, and slay responsibly. No cap. π¦β¨π
π¦ 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