1constant::tiny(3)     User Contributed Perl Documentation    constant::tiny(3)
2
3
4

NAME

6       constant::tiny - Perl pragma to declare constants
7

SYNOPSIS

9           use constant::tiny;
10           use constant PI    => 4 * atan2(1, 1);
11           use constant DEBUG => 0;
12
13           print "Pi equals ", PI, "...\n" if DEBUG;
14

DESCRIPTION

16       This module is a lightweight version of the Perl standard module
17       "constant.pm". Here are the keys differences:
18
19       ·   only works on Perl 5.10+ in order to simplify a good part of the
20           code
21
22       ·   doesn't support Unicode names; please use the standard
23           "constant.pm" module if you need to create constants with Unicode
24           names
25
26       ·   stricter rules about valid names, only allow names with alphanums
27           ("[a-zA-Z0-9]" and underscore ("_"), allowing one optional leading
28           underscore
29
30       In order to simplify its usage, "constant:tiny" uses the normal
31       "constant" API. The main advatange is that switching your code to
32       "constant::tiny" means simply adding it before the first "use
33       constant". The disadvantage is that, obviously, both modules can't be
34       used at the same time. If the normal "constant" was loaded before
35       "constant::tiny", the latter won't do anything, letting the normal
36       "constant" do the work.
37
38       Other than this, the usage is (nearly) exactly the same as with the
39       standard "constant" module. For more details, please read constant.
40
41   Rationale
42       The original reason to write this module was that, starting with
43       version 1.24, "constant" always loaded utf8_heavy.pl, which consumes
44       some memory. Usually, this is not problematic, but in some particular
45       cases (embedded Perl, frequently forked programs a la CGI), the
46       increased memory cost can become a concern.
47
48       Therefore, this module was written as a alternative solution, with no
49       support for Unicode names, so that programs working in memory
50       constrained environments could have a better control.
51
52       Funnily enough, the day "constant::tiny" was released on CPAN (the code
53       had been written two months earlier as a proof of concept), Brad
54       Gilbert proposed a patch for "constant" in order to delay loading
55       utf8_heavy.pl until necessary.
56
57       Therefore "constant::tiny" is less useful (which is good news), but can
58       still address specific needs, if you want to restrict constant names to
59       alphanums only.
60

SUPPORT

62       You can find documentation for this module with the perldoc command.
63
64           perldoc constant::tiny
65
66       You can also look for information at:
67
68       ·   Search CPAN
69
70           <http://search.cpan.org/dist/constant-tiny/>
71
72       ·   Meta CPAN
73
74           <https://metacpan.org/module/constant::tiny>
75
76       ·   RT: CPAN's request tracker (report bugs here)
77
78           <https://rt.cpan.org/Public/Dist/Display.html?Name=constant-tiny>.
79
80       ·   AnnoCPAN: Annotated CPAN documentation
81
82           <http://annocpan.org/dist/constant-tiny>
83
84       ·   CPAN Ratings
85
86           <http://cpanratings.perl.org/d/constant-tiny>
87

BUGS

89       Please report any bugs or feature requests to "contant-tiny at
90       rt.cpan.org", or through the web interface at
91       <https://rt.cpan.org/Public/Dist/Display.html?Name=constant-tiny>.  I
92       will be notified, and then you'll automatically be notified of progress
93       on your bug as I make changes.
94

ACKNOWLEDGEMENTS

96       This module is heavily based on "constant.pm", originaly written by Tom
97       Phoenix, Casey West, Nicholas Clark, Zefram and many other folks from
98       the Perl 5 Porters.
99

AUTHOR

101       Sebastien Aperghis-Tramoni "<sebastien at aperghis.net>"
102

LICENSE

104       This module is free software; you can redistribute it or modify it
105       under the same terms as Perl itself.
106
107
108
109perl v5.28.0                      2018-07-15                 constant::tiny(3)
Impressum