Fix typos
perl: Add more inline documentation and put the existing one in the right spot
perl: Fix timeout error code reporting
perl: Remove unused code
perl: Mark all internal functions as such, so they are handled correctly by documentation checks

Also move the error code to the Error class and add a get_code() and
get_message() subroutine.