perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jie Gao <J....@sydney.edu.au>
Subject Re: About config file
Date Thu, 07 Mar 2013 03:15:51 GMT
Hi Ken

You can follow this:

    http://perl.apache.org/docs/2.0/devel/core/coding_style.html

if you are after a standard coding style.

Regards,

Jie 

* Ken Peng <yhpeng@orange.fr> wrote:

> Date: Thu, 7 Mar 2013 11:00:37 +0800
> From: Ken Peng <yhpeng@orange.fr>
> To: modperl@perl.apache.org
> Subject: About config file
> User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130215
>  Thunderbird/17.0.3
> 
> Hello,
> 
> How do you setup config file in modperl web development?
> I currently use the style like a package:
> 
> package Myconfig;
> 
> sub new {
>     my $class = shift;
>     my $option = { key1 => 'foo', key2 => 'bar', ... };
>     bless $option,$class;
> }
> 
> 1;
> 
> 
> Then in the modperl program:
> 
> use Myconfig;
> 
> my $conf = Myconfig->new;
> my $opt1 = $conf->{key1};
> my $opt2 = $conf->{key2};
> ...
> 
> 
> I don't know if this is a good way. Do you have suggestions?
> 
> Thanks.

Mime
View raw message