perl: Run the entire Perl thing in a single thread

Instead of having init/deinit in one thread and queue in another, pull
all of them together into the worker thread. We can avoid confusing Perl
to the point of crashing by organizing things this way. This fixes #53.

Reported-by: Fabien Wernli
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>