The forked child process is meant to return the content, not to the parent process, but to the connected client. The exit causes all open file handles to be flushed and closed. Thus the content is delivered to the client.
Without the exit, the forked child would continue to execute the parent's code after returning from the anonymous sub.
In reply to Re^3: Dancer and forking
by shmem
in thread Dancer and forking
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |