Sébastien Aperghis-Tramoni > constant-tiny-1.00 > constant::tiny



Annotate this POD


Open  0
View/Report Bugs
Module Version: 1.00   Source   Latest Release: constant-tiny-1.02


constant::tiny - Perl pragma to declare constants


    use constant::tiny;
    use constant PI    => 4 * atan2(1, 1);
    use constant DEBUG => 0;

    print "Pi equals ", PI, "...\n" if DEBUG;


This module is a lightweight version of Perl standard constant.pm. Here are the keys differences:

The rationale behind this module is that recent versions of constant.pm have a better support for Unicode names. However, this means loading full Unicode support (utf8_heavy.pl) which consumes memory. In most cases, the difference is not problematic. But in some particular cases (embedded Perl, frequently forked programs a la CGI), the increased memory cost can become a concern. This is even more annoying if the program doesn't use Unicode at all and therefore pays the high price.

Hence this module, which provides a very simple solution, only requiring you to add use constant::tiny before any declaration of constants.

Other than this, the usage is (nearly) exactly the same as with the standard constant.pm module. For more details, please read constant.


You can find documentation for this module with the perldoc command.

    perldoc constant::tiny

You can also look for information at:


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


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


Sébastien Aperghis-Tramoni <sebastien at aperghis.net>


This module is free software; you can redistribute it or modify it under the same terms as Perl itself.

syntax highlighting: