get '/my_stuff' => sub {
my $my_stuff = config->{my_stuff} || {};
my $x = $my_stuff->{X} || 'not set';
my $y = $my_stuff->{Y} || 'not set';
return "X[$x] Y[$y]";
};
get '/my_new_stuff' => sub {
set my_stuff => {X => 'newX', Y => 'newY'};
return 'New stuff configured.';
};
####
$ cat config.yml
my_stuff: { X: 'oldX' }
####
$ curl http://localhost:3000/my_stuff
X[oldX] Y[not set]
$ curl http://localhost:3000/my_new_stuff
New stuff configured.
$ curl http://localhost:3000/my_stuff
X[newX] Y[newY]