added a test to check proper passing of perl args
revert return value processing to avoid mangling -1 badly
add protection against SIGPIPE terminating the host perl