PROTON-176: Fixes to Perl code due to unit test failures.

Fixes for code that failed the new unit tests.
PROTON-176: Provide Perl unit tests.