When PP
sub is called the CX
for this sub is created.
By accessing this context by CxHASARGS(CX_CUR())
we can check this sub hasargs
or not.
But for the XSUB
context is not created, so we can not use this trick.
Is is possible to know XSUB
was called using &sub
or not?
UPD
Looking at sources at pp_entersub
when cv
is XSUB
. We can see how code handle hasargs
. It access PL_op->op_flags & OPf_STACKED
then a bit later call the target XSUB
:
if( PL_op->op_flags & OPf_STACKED ...
...
CvXSUB(cv)(aTHX_ cv);
Will it be OK if I in my XSUB
I do same check of PL_op->op_flags & OPf_STACKED
?