[Dancer-users] setup config.yml
davidp at preshweb.co.uk
Wed Jan 19 13:05:06 CET 2011
On Wed, 2011-01-19 at 17:38 +0800, yang xm wrote:
> Is there any good way to change config.yml from code, and save it to
> like use Dancer::Config 'setting'; ?
You mean to modify settings at runtime, then write them back to the
Dancer doesn't provide any facility to do that (it's not something I'd
imagine many people would need to do, nor something I'd encourage), but
you could roll your own quite simply with something along the lines of:
my $yaml = to_yaml(config());
open (my $configfh, '>',
) or die "Failed to open config file to write - $!";
print $fh $yaml;
You could easily write this as a plugin to release to CPAN (e.g.
Dancer::Plugin::UpdateConfig, or something).
David Precious <davidp at preshweb.co.uk> ("bigpresh")
More information about the Dancer-users