Thanks t0m.  I will do the MyApp::Constants thing, thanks for the idea.

But out of curiosity... in your opinion, what *would* be the "best practice" way of doing what I'm trying to achieve? (or was your comment "Not sure this is the 'best practice' way of doing what you're trying to achieve" referring to my way of doing things, and your opinion of best practice is the MyApp::Constants thing?) Yeah, it appears that is what you meant...

I've been doing my thing in isolation for so long, I'm completely disconnected from best practices, which is why I'm asking... that, and I am a bit of a Perl hack. Being here is definitely raising my game!

jarom smith
tech go-to guy


Tomas Doran wrote:
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: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to