less(3pm)

πŸ’… less(3pm)

okay so real talk, this is the less pragma from the Perl Programmers Reference Guide, and it is genuinely one of the silliest little icons in the whole core distribution. it's a user-pragma β€” a way for you to politely tell your code "hey bestie, maybe chill?" and then hope somebody actually listens. no cap.


✨ SYNOPSIS ✨

use less 'CPU';

that's it. that's the whole vibe. πŸŽ€


🌸 DESCRIPTION 🌸

okay so first things first: this is a user-pragma. if you're <em>very</em> lucky, some code you're already using will know that you asked for less CPU usage, or less ram, or less fat, or... honestly? we just can't know. we are not omniscient. consult your documentation on everything you're currently using, because less is not gonna read the docs for you. πŸ’€

for general suggestions though, try requesting "CPU" or "memory" β€” those are the classics:

use less 'memory';
use less 'CPU';
use less 'fat';

and if you ask for nothing in particular? then you're asking for less 'please'. periodt. 🫢

use less 'please';

πŸ‘‘ FOR MODULE AUTHORS πŸ‘‘

so less has been sitting in the core as a "joke" module for ages now (yes, the scare quotes are canon, the original says so) and for most of that time it had literally no real way of communicating any information to anything. it was just... there. vibing. main character energy with no plot. 😭

but thanks to Nicholas Clark we have user pragmas now (see perlpragma), and now "less" can actually do something. slay. πŸ”₯

you can probably expect your users to be able to guess that they can request less CPU or memory or just "less" overall β€” it's pretty intuitive, ngl.

and if the user didn't specify anything at all? that's interpreted as having used the "please" tag. it's up to you to make this useful. no pressure bestie. πŸ’–

# equivalent
use less;
use less 'please';

🌈 "BOOLEAN = less->of( FEATURE )"

the class method less->of( NAME ) returns a boolean β€” just a yes/no β€” to tell you whether your user requested less of something. super simple, super iconic:

if ( less->of( 'CPU' ) ) {
    ...
}
elsif ( less->of( 'memory' ) ) {

}

⭐ "FEATURES = less->of()"

if you don't ask for any feature, you get the list of features that the user requested you to be nice to. and here's the cute part β€” this has the nice side effect that if you don't respect anything in particular, you can just ask for it and use it like a boolean. free real estate πŸŽ€

if ( less->of ) {
    ...
}
else {
    ...
}

πŸ™ˆ CAVEATS πŸ™ˆ

This probably does nothing.

like... genuinely. probably nothing. πŸ’€

This works only on 5.10+ β€” but at least it's backwards compatible in not doing much. 😌 so on older perls it just quietly does nothing instead of exploding, which honestly is the most respectful possible behaviour. we stan a low-maintenance module.


and that's the whole page, bestie! πŸ¦‹ this little love letter to politely requesting less stuff is less(3pm) from perl v5.42.3, dated 2026-11-03 β€” go forth and ask for less, or don't, it probably does nothing either way πŸ’œβœ¨

πŸ“¦ where this page comes from