Is there any reason he can't use Config::Any?

Then he can load his json structures directly (via .json file) or load variables from a .pl file.

Maybe I've missed the scope of the problem, but op's example immediately made me think he's trying to build config files as classes. While you could use moose (Or mouse, or moo, etc.) And build your config options as parameters, e.g.:

package My::Config
use Moose;

has 'param1' => (
    is => 'ro',
    isa => 'Str',
    default => 'Bob',

Then later

package main;

my $cfg = My::Config->new;
do_stuff $cfg->param1, '12';

Or whatever method invocation would make use of those variables.

Config::Any effectively gives you an OO interface to your config file without having to build the class by hand.

Admittedly, the last project I had that used mod_perl was a long time ago, and I've just stayed subscribed to this list because I really enjoy most of your discussions (and typically learn a thing or two) so this probably isn't the most canonical "mod_perl" thinking...

I think it's a good solution because it provides a "simple" interface to complex config files. But would really like to understand the flaws in my thinking if you're going to shoot me down.

Jon A

On Mar 6, 2013 8:19 PM, "Ken Peng" <> wrote:
于 2013-3-7 11:15, Jie Gao 写道:
You can follow this:

if you are after a standard coding style.


Thanks. but I don't think it's something about coding style.