Refactor perlconfig

This is the chunk of code in idle/away hooks (https://github.com/barnowl/barnowl/pull/49) which I have no significant basis for thinking is reasonable, and on which I've not recieved any comments since I've asked about it two years ago (other than that it compiles and doesn't seem to break anything).  Now that we have the updated code review policy, I figure I'll post this to the mailing list, and merge it in a week or two if no-one comments on it.

The two outcomes of these commits are:
* there's support for calling perl methods and interpreting the return value as a boolean or integer
* error messages on malformed calls of perl methods are more consistent

I need the first of these to move "away" logic into perl, and query it from C.