using constant is a very good thing to do. However, if you don't know what constant is doing, you can be very surpsised.
use constant LOG_DIRECTORY => '/foo/bar/baz';
# Equivalent to
sub LOG_DIRECTORY () { '/foo/bar/baz' }
The most obvious problem is interpolation in double-quoted strings.
Similarly, you can't use LOG_DIRECTORY as the key to a hash, because it's not a C-style preprocessor declaration, but a function declaration.
Just, be careful and know what is happening under the hood.
------ We are the carpenters and bricklayers of the Information Age. Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement. |