| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 3 |
.\" |
| 4 |
.\" Standard preamble: |
| 5 |
.\" ======================================================================== |
| 6 |
.de Sp \" Vertical space (when we can't use .PP) |
| 7 |
.if t .sp .5v |
| 8 |
.if n .sp |
| 9 |
.. |
| 10 |
.de Vb \" Begin verbatim text |
| 11 |
.ft CW |
| 12 |
.nf |
| 13 |
.ne \\$1 |
| 14 |
.. |
| 15 |
.de Ve \" End verbatim text |
| 16 |
.ft R |
| 17 |
.fi |
| 18 |
.. |
| 19 |
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. |
| 20 |
.ie n \{\ |
| 21 |
. ds C` "" |
| 22 |
. ds C' "" |
| 23 |
'br\} |
| 24 |
.el\{\ |
| 25 |
. ds C` |
| 26 |
. ds C' |
| 27 |
'br\} |
| 28 |
.\" |
| 29 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 30 |
.ie \n(.g .ds Aq \(aq |
| 31 |
.el .ds Aq ' |
| 32 |
.\" |
| 33 |
.\" If the F register is >0, we'll generate index entries on stderr for |
| 34 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 35 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 36 |
.\" output yourself in some meaningful fashion. |
| 37 |
.\" |
| 38 |
.\" Avoid warning from groff about undefined register 'F'. |
| 39 |
.de IX |
| 40 |
.. |
| 41 |
.nr rF 0 |
| 42 |
.if \n(.g .if rF .nr rF 1 |
| 43 |
.if (\n(rF:(\n(.g==0)) \{\ |
| 44 |
. if \nF \{\ |
| 45 |
. de IX |
| 46 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 47 |
.. |
| 48 |
. if !\nF==2 \{\ |
| 49 |
. nr % 0 |
| 50 |
. nr F 2 |
| 51 |
. \} |
| 52 |
. \} |
| 53 |
.\} |
| 54 |
.rr rF |
| 55 |
.\" ======================================================================== |
| 56 |
.\" |
| 57 |
.IX Title "less 3perl" |
| 58 |
.TH less 3perl 2025-11-16 "perl v5.40.1" "Perl Programmers Reference Guide" |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
less \- perl pragma to request less of something |
| 65 |
.SH SYNOPSIS |
| 66 |
.IX Header "SYNOPSIS" |
| 67 |
.Vb 1 |
| 68 |
\& use less \*(AqCPU\*(Aq; |
| 69 |
.Ve |
| 70 |
.SH DESCRIPTION |
| 71 |
.IX Header "DESCRIPTION" |
| 72 |
This is a user-pragma. If you're very lucky some code you're using |
| 73 |
will know that you asked for less CPU usage or ram or fat or... we |
| 74 |
just can't know. Consult your documentation on everything you're |
| 75 |
currently using. |
| 76 |
.PP |
| 77 |
For general suggestions, try requesting \f(CW\*(C`CPU\*(C'\fR or \f(CW\*(C`memory\*(C'\fR. |
| 78 |
.PP |
| 79 |
.Vb 3 |
| 80 |
\& use less \*(Aqmemory\*(Aq; |
| 81 |
\& use less \*(AqCPU\*(Aq; |
| 82 |
\& use less \*(Aqfat\*(Aq; |
| 83 |
.Ve |
| 84 |
.PP |
| 85 |
If you ask for nothing in particular, you'll be asking for \f(CWless |
| 86 |
\&\*(Aqplease\*(Aq\fR. |
| 87 |
.PP |
| 88 |
.Vb 1 |
| 89 |
\& use less \*(Aqplease\*(Aq; |
| 90 |
.Ve |
| 91 |
.SH "FOR MODULE AUTHORS" |
| 92 |
.IX Header "FOR MODULE AUTHORS" |
| 93 |
less has been in the core as a "joke" module for ages now and it |
| 94 |
hasn't had any real way to communicating any information to |
| 95 |
anything. Thanks to Nicholas Clark we have user pragmas (see |
| 96 |
perlpragma) and now \f(CW\*(C`less\*(C'\fR can do something. |
| 97 |
.PP |
| 98 |
You can probably expect your users to be able to guess that they can |
| 99 |
request less CPU or memory or just "less" overall. |
| 100 |
.PP |
| 101 |
If the user didn't specify anything, it's interpreted as having used |
| 102 |
the \f(CW\*(C`please\*(C'\fR tag. It's up to you to make this useful. |
| 103 |
.PP |
| 104 |
.Vb 3 |
| 105 |
\& # equivalent |
| 106 |
\& use less; |
| 107 |
\& use less \*(Aqplease\*(Aq; |
| 108 |
.Ve |
| 109 |
.ie n .SS """BOOLEAN = less\->of( FEATURE )""" |
| 110 |
.el .SS "\f(CWBOOLEAN = less\->of( FEATURE )\fP" |
| 111 |
.IX Subsection "BOOLEAN = less->of( FEATURE )" |
| 112 |
The class method \f(CW\*(C`less\->of( NAME )\*(C'\fR returns a boolean to tell you |
| 113 |
whether your user requested less of something. |
| 114 |
.PP |
| 115 |
.Vb 4 |
| 116 |
\& if ( less\->of( \*(AqCPU\*(Aq ) ) { |
| 117 |
\& ... |
| 118 |
\& } |
| 119 |
\& elsif ( less\->of( \*(Aqmemory\*(Aq ) ) { |
| 120 |
\& |
| 121 |
\& } |
| 122 |
.Ve |
| 123 |
.ie n .SS """FEATURES = less\->of()""" |
| 124 |
.el .SS "\f(CWFEATURES = less\->of()\fP" |
| 125 |
.IX Subsection "FEATURES = less->of()" |
| 126 |
If you don't ask for any feature, you get the list of features that |
| 127 |
the user requested you to be nice to. This has the nice side effect |
| 128 |
that if you don't respect anything in particular then you can just ask |
| 129 |
for it and use it like a boolean. |
| 130 |
.PP |
| 131 |
.Vb 6 |
| 132 |
\& if ( less\->of ) { |
| 133 |
\& ... |
| 134 |
\& } |
| 135 |
\& else { |
| 136 |
\& ... |
| 137 |
\& } |
| 138 |
.Ve |
| 139 |
.SH CAVEATS |
| 140 |
.IX Header "CAVEATS" |
| 141 |
.IP "This probably does nothing." 4 |
| 142 |
.IX Item "This probably does nothing." |
| 143 |
.PD 0 |
| 144 |
.IP "This works only on 5.10+" 4 |
| 145 |
.IX Item "This works only on 5.10+" |
| 146 |
.PD |
| 147 |
At least it's backwards compatible in not doing much. |