Jarom Smith wrote:
In the end, this is what I decided to do because I have relatively few of these guys (so far) and I'd rather have them thrown together all in one place than spread all over the system. But I'm wondering if there is a best practice?

I don't want to put them in the config hash or in a configuration file
because these are not things that a user should be able to change or override.

Not sure this is the 'best practice' way of doing what you're trying to achieve, but that aside - to answer your actual question:

I'd just put them all into their own package, and arrange for them to be exportable, something like this:

package MyApp::Constants;
use strict;
use warnings;
use Exporter qw/import/;

use constant {
    THING_FOO => 0,
    THING_BAR => 1,
};

our @EXPORT = qw(
    &THING_FOO
    &THING_BAR
);

then just 'use MyApp::Constants;' where you need them, job done..

Cheers
t0m

_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to