In perl.git, the branch blead has been updated <https://perl5.git.perl.org/perl.git/commitdiff/daf3bcffaec08075beb6b20fa7aea2dbfeab9af6?hp=a85aec40e61a21ebd6e61fb1b82b3910e9f951db>
- Log ----------------------------------------------------------------- commit daf3bcffaec08075beb6b20fa7aea2dbfeab9af6 Author: Father Chrysostomos <spr...@cpan.org> Date: Mon Dec 18 09:37:08 2017 -0800 perlxs: Document bitwise calling conventions ----------------------------------------------------------------------- Summary of changes: dist/ExtUtils-ParseXS/lib/perlxs.pod | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/dist/ExtUtils-ParseXS/lib/perlxs.pod b/dist/ExtUtils-ParseXS/lib/perlxs.pod index 6b21d966a9..b72e6f6e20 100644 --- a/dist/ExtUtils-ParseXS/lib/perlxs.pod +++ b/dist/ExtUtils-ParseXS/lib/perlxs.pod @@ -1332,8 +1332,13 @@ C<BAR::getit()> for this function. Instead of writing an overloaded interface using pure Perl, you can also use the OVERLOAD keyword to define additional Perl names for your functions (like the ALIAS: keyword above). However, the -overloaded functions must be defined with three parameters (except -for the nomethod() function which needs four parameters). If any +overloaded functions must be defined in such a way as to accept the number +of parameters supplied by perl's overload system. For most overload +methods, it will be three parameters; for the C<nomethod> function it will +be four. However, the bitwise operators C<&>, C<|>, C<^>, and C<~> may be +called with three I<or> five arguments (see L<overload>). + +If any function has the OVERLOAD: keyword, several additional lines will be defined in the c file generated by xsubpp in order to register with the overload magic. @@ -1344,7 +1349,7 @@ the actual SV stored within the blessed RV. See the sample for T_PTROBJ_SPECIAL below. To use the OVERLOAD: keyword, create an XS function which takes -three input parameters ( or use the c style '...' definition) like +three input parameters (or use the C-style '...' definition) like this: SV * @@ -1361,6 +1366,10 @@ characters, you must type the parameter without quoting, separating multiple overloads with whitespace. Note that "" (the stringify overload) should be entered as \"\" (i.e. escaped). +Since, as mentioned above, bitwise operators may take extra arguments, you +may want to use something like C<(lobj, robj, swap, ...)> (with +literal C<...>) as your parameter list. + =head2 The FALLBACK: Keyword In addition to the OVERLOAD keyword, if you need to control how -- Perl5 Master Repository