NAME
constant::override - Override/ignore constants
SYNOPSIS
use constant::override ignore     => [ 'SO_CONFIG_FILE' ],
                       substitute => { 'MYCONST1' => 1,
                                       'MYCONST2' => sub { 2 } };
use constant SO_CONFIG_FILE => 100;
use constant MYCONST1       => 200;
use constant MYCONST2       => 300;
eval { SO_CONFIG_FILE() };      # Undefined function error.
print MYCONST1,"\n";            # 1.
print MYCONST2,"\n";            # 2.
DESCRIPTION
Provides for overriding constant's import method, so that the 'constant' functions can be replaced with your own functions/values, or ignored altogether.
use constant::override ... statements must occur before use constant ... statements.
PUBLIC METHODS
- import
 - 
Takes a hash of arguments:
- ignore
 - 
An arrayref of constant names (may be package-qualified). Any subsequent attempt to define a constant with this name will be silently ignored.
 - substitute
 - 
A hashref mapping from constant name (may be package-qualified) to either a scalar value or a coderef. Any subsequent attempt to define a constant with that name will cause the constant to map to either the specified coderef, or a coderef that returns the specified scalar value.
 
Package-qualified constants are preferred to bare constants, and substituting a constant is preferred to ignoring a constant, when determining what to do on subsequent calls to
import. 
BUGS
Please report any bugs or feature requests to bug-constant-override at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=constant-override.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc constant::override
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
AUTHOR
Tom Harrison
APNIC Software, C<< <cpan at apnic.net> >>
LICENSE AND COPYRIGHT
Copyright 2013 APNIC Pty Ltd.
This library is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
The full text of the license can be found in the LICENSE file included with this module.