1less(3pm)              Perl Programmers Reference Guide              less(3pm)
2
3
4

NAME

6       less - perl pragma to request less of something
7

SYNOPSIS

9           use less 'CPU';
10

DESCRIPTION

12       This is a user-pragma. If you're very lucky some code you're using will
13       know that you asked for less CPU usage or ram or fat or... we just
14       can't know. Consult your documentation on everything you're currently
15       using.
16
17       For general suggestions, try requesting "CPU" or "memory".
18
19           use less 'memory';
20           use less 'CPU';
21           use less 'fat';
22
23       If you ask for nothing in particular, you'll be asking for "less
24       'please'".
25
26           use less 'please';
27

FOR MODULE AUTHORS

29       less has been in the core as a "joke" module for ages now and it hasn't
30       had any real way to communicating any information to anything. Thanks
31       to Nicholas Clark we have user pragmas (see perlpragma) and now "less"
32       can do something.
33
34       You can probably expect your users to be able to guess that they can
35       request less CPU or memory or just "less" overall.
36
37       If the user didn't specify anything, it's interpreted as having used
38       the "please" tag. It's up to you to make this useful.
39
40         # equivalent
41         use less;
42         use less 'please';
43
44   "BOOLEAN = less->of( FEATURE )"
45       The class method "less->of( NAME )" returns a boolean to tell you
46       whether your user requested less of something.
47
48         if ( less->of( 'CPU' ) ) {
49             ...
50         }
51         elsif ( less->of( 'memory' ) ) {
52
53         }
54
55   "FEATURES = less->of()"
56       If you don't ask for any feature, you get the list of features that the
57       user requested you to be nice to. This has the nice side effect that if
58       you don't respect anything in particular then you can just ask for it
59       and use it like a boolean.
60
61         if ( less->of ) {
62             ...
63         }
64         else {
65             ...
66         }
67

CAVEATS

69       This probably does nothing.
70       This works only on 5.10+
71           At least it's backwards compatible in not doing much.
72
73
74
75perl v5.32.1                      2021-03-31                         less(3pm)
Impressum