GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  CONSTANT::DEF (3)

.ds Aq ’

NAME

constant::def - Perl pragma to declare previously undeclared constants

CONTENTS

VERSION

Version 0.01

SYNOPSIS

Define compile-time constant only if it wasn’t previously defined elsewhere. The main reason is to use for debugging constants, since there is no way to change the value, except by editing the source



    # common way: (redefine may be done only in source file)
    use constant DEBUG => ...;
    # or
    BEGIN { *DEBUG = sub () { ... } }
    # or
    sub DEBUG () { ... }

    ################

    # complex way: redefine works, if done before use of module
    # in main.pl
    BEGIN { *My::Module::Debug = sub () { 1 }; }
    use My::Module;

    # in My/Module.pm
    BEGIN { defined &DEBUG or do { my $debug = $ENV{MY_MODULE_DEBUG} || 0; *DEBUG = sub () { $debug } } }

    ################

    # using this distribution
    # redefine works, if done before use of module

    # in main.pl
    use constant::abs My::Module::DEBUG => 1;
    use My::Module;

    # in My/Module.pm
    use constant::def DEBUG => $ENV{MY_MODULE_DEBUG} || 0;



Syntax is fully compatible with constant

SEE ALSO

constant::abs, constant

AUTHOR

Mons Anderson, <mons at cpan.org>

BUGS

Please report any bugs or feature requests to bug-constant-def at rt.cpan.org, or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=constant-def>. I will be notified, and then you’ll automatically be notified of progress on your bug as I make changes.

COPYRIGHT & LICENSE

Copyright 2009 Mons Anderson.

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

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 CONSTANT::DEF (3) 2009-03-11

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.