I'm starting on the task of converting a preforking server into a
non-blocking server for a small webservice. One of my handlers generates a
data structure by reading the content of a subtree of files.
In essense, it does something like this:
...
my $data = {
map { $_ => Mojo::Util::slurp("/path/to/files/$_" }
(qw(one two three four));
};
$c->render(json => $data);
};
Can someone give me some hints as to how to do that as a series of
non-blocking callbacks, or do we just shrug and say "it's not going to
block for too long".
Thanks