Fixed a few bugs in perl lib wrt FileDescriptor

Also added basic tests for FileDescriptor objects