Closed phillipod closed 9 years ago
Converting a perl timeout variable to a struct timeval will be done in 5 places once ldap_set_option() supports it, so it makes sense to refactor this into a helper.
And in order to better support Perl idioms and indeed increased granularity, it makes sense to use the Perl API to determine whether we are being passed an integer or a double, and populate the struct timeval accordingly.
The question is how to handle an erroneous value such as a string that is neither integer nor floating point - my preference would be to treat this as 'undef instead of settings tv_secs to -1', i.e, NULL is passed to the destination function as the struct timeval - allowing OpenLDAP's ldap_set_option(LDAP_OPT_TIMEOUT), or OpenLDAP and Mozilla LDAP's ldap_set_option(LDAP_OPT_TIMELIMIT) (as appropriate) to override these as well.
Edit: On second thought, it'd make more sense to return LDAP_PARAM_ERROR if an invalid timeout is specified.
See #20 for full background.
ldap_set_option() and ldap_get_option() do not have support to serialize/deserialize 'struct timeval' option objects, and so for example an invalid parameter is passed into the C ldap_set_option(), resulting in a -1 return.