diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-02-21 18:31:42 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-02-21 18:31:42 +0000 |
commit | 4628e4f8c013135d9c9ab7023d7730ab67289444 (patch) | |
tree | ad9e7adff33e4c82f45719e2dc79976e3f967a68 /pod/perlxs.pod | |
parent | b22c7a20398f928f9697b491d180b979ff211bd6 (diff) | |
download | perl-4628e4f8c013135d9c9ab7023d7730ab67289444.tar.gz |
allow optional XSUB parameters without being forced to use a
default (from Hugo van der Sanden)
p4raw-id: //depot/perl@5183
Diffstat (limited to 'pod/perlxs.pod')
-rw-r--r-- | pod/perlxs.pod | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/pod/perlxs.pod b/pod/perlxs.pod index a2755b8f2d..2055ce6d39 100644 --- a/pod/perlxs.pod +++ b/pod/perlxs.pod @@ -502,9 +502,9 @@ C<ST(1)>. =head2 Default Parameter Values -Default values for XSUB arguments can be specified by -placing an assignment statement in the parameter list. The -default value may be a number or a string. Defaults should +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 C<undef>. Defaults should always be used on the right-most parameters only. To allow the XSUB for rpcb_gettime() to have a default host @@ -1314,6 +1314,19 @@ methods will be called as this: THIS->set_blue( val ); +You could also write a single get/set method using an optional argument: + + int + color::blue( val = undef ) + int val + PROTOTYPE $;$ + CODE: + if (items > 1) + THIS->set_blue( val ); + RETVAL = THIS->blue(); + OUTPUT: + RETVAL + If the function's name is B<DESTROY> then the C++ C<delete> function will be called and C<THIS> will be given as its parameter. The generated C++ code for |