|
Default values for XSUB arguments can be specified by placing an assignment statement in
the parameter list. The default value may be a number, a string or the special string NO_INIT.
Defaults should always be used on the right-most parameters only.
To allow the XSUB for rpcb_gettime() to have a default host value the parameters to the
XSUB could be rearranged. The XSUB will then call the real rpcb_gettime() function with the
parameters in the correct order. This XSUB can be called from Perl with either of the
following statements:
$status = rpcb_gettime( $timep, $host );
$status = rpcb_gettime( $timep );
|
|
The XSUB will look like the code which follows. A CODE: block is used to call the real
rpcb_gettime() function with the parameters in the correct order for that function.
bool_t
rpcb_gettime(timep,host="localhost")
char *host
time_t timep = NO_INIT
CODE:
RETVAL = rpcb_gettime( host, &timep );
OUTPUT:
timep
RETVAL
|
|
|
|