in reply to Cross-Package/Object Communication

Since you were talking about config parameters and such....

I usually have a package that defines some constants, and use it like

use My::Constants qw/ MY_FOO MY_BAR MY_LOGFILE_NAME /; my $fh = IO::File->new( MY_LOGFILE_NAME ); ....

My::Constants has default values for those constants, and optionally overrides those values with values that it reads from a XML config file , or from %ENV

I do this instead of using a config hash or something mainly because I wanted a compile time check of config variable names

Replies are listed 'Best First'.
Re: Re: Cross-Package/Object Communication
by billyak (Friar) on Aug 21, 2002 at 17:44 UTC
    Great idea! After maybe half an hour (hey, I did figure it out) I can make an empty hash or array ref as a constant then bless _that_. So my object ref will be a constant. :) Excellent.

    -billyak