On 03/06/2013 11:21 PM, Jon wrote:
>
> Is there any reason he can't use Config::Any?
> http://search.cpan.org/~bricas/Config-Any-0.23/lib/Config/Any.pm
> <http://search.cpan.org/%7Ebricas/Config-Any-0.23/lib/Config/Any.pm>
>
>

There's no reason why he can't use any Config package, or roll his own
using json, or yaml, or whatever format he prefers.

It could be as simple as this:

package MyConfig;

use Sub::Exporter -setup => { exports => [ qw(get_config) ] };

use YAML::Syck;

my $config;

sub get_config {
    if (defined($config)) {
        return $config
    }
    $config = LoadFile('/www/etc/lolol.com/site.yaml');
    return $config
}

1;

This particular version will only load the file once, so if you change
the config you need to kick the webserver, but you can tailor this, or
any solution to suit whatever your needs are.

Adam

Reply via email to