Thanks for the response Jesse. I have a couple of follow-up questions:

In article <[EMAIL PROTECTED]>, Jesse Erlbaum wrote:
>
> 
> For "configuration file" params (to use your idiom), I tend to use Perl
> modules:
> 
>   package Site::Configuration;
>   use constant SMTP_SERVER => "localhost";
> 
> ...and in my CGI-App:
> 
>   package Site::MyApp;
>   use base qw/CGI::Application/;
>   use Site::Configuration;
>   my $smtp_server = Site::Configuration::SMTP_SERVER;
> 
> This allows me to put more functionality into my configuration:
> 
>   package Site::Configuration;
>   sub SMTP_SERVER {
>     if ($ENV{DEVMODE}) {
>       return "localhost";
>     } else {
>       return "smtp.site.com";    }
>   }

To save typing "use constant" over and over, have you considered using
the "hash ref" method of declaring all your constants, you can just
type:
        use constant $href;

Also, do you actually need to declare your sub as 

"sub SMTP_SERVER ($)"... for it to be used as a bare word? I'm not a
user of the 'constant' module yet, but that was my impression from the
docs.

Another question: Do you store Site::Configuration in the "perllib"
directory with the other perl modules? I found this made site launches a
little more difficult, because I would want to copy "everything but the
Config module" to the live site, which have an existing Config module
configured for the live site. Instead, I store a config file in a
"config" directory.

Perhaps you solve this with the "if $ENV{DEVMODE}" construct you
illustrated above.

        Mark

-- 
 . . . . . . . . . . . . . . . . . . . . . . . . . . . 
   Mark Stosberg            Principal Developer  
   [EMAIL PROTECTED]     Summersault, LLC     
   765-939-9301 ext 202     database driven websites
 . . . . . http://www.summersault.com/ . . . . . . . .


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[EMAIL PROTECTED]/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to