I have an xs in which I'd like to know the value of a sort
subpragma in the calling script. So I have something like:
#script.pl
use sort 'stable';
# functionality implemented in myext.xs
In the C sources for myext I have copied something from
pp_sort.c:
#define SORTHINTS(hintsv) \
(((hintsv) = GvSV(gv_fetchpv("sort::hints", GV_ADDMULTI, SVt_IV))), \
(SvIOK(hintsv) ? ((I32)SvIV(hintsv)) : 0))
to be used as:
if(SORTHINTS(hintsv) & HINT_SORT_STABLE)
/* do something for stable sort */
else
/* do something else */
The problem is SORTHINTS does not give me the
right values in myext and control always flows to the else.
My guess is it is looking in the wrong interpreter context
but I don't know how to access the context for
the calling script and get the right value.
Thanks,
Zartaj
Thread Next