In perl special tokens like __PACKAGE__
, __SUB__
, __FILE__
, __LINE__
exists and available from script.
I may get value of __PACKAGE__
from XS
as HvNAME( PL_currstash )
, I suppose.
But how to access others?
Is there special interface to access all of them from XS
? Like: CTX->package
, CTX->sub
etc.
XS
mechanism exists. I ask how to access token__SUB__
fromXS
– Anaplasty__LINE__
and__FILE__
are replaced at compile time. See more here – EquitantPL_curstname
for the package name, no? (I'm not sure about it, but from what I read inintrpvar.h
, it seems more like it. Have a look at this file, and atembedvar.h
as well, it could help you find what you are looking for. – Smallsword__LINE__
and__FILE__
are replaced at compile time. However, you should still be able to get informations about the line or file, since when adie
happens for instance, Perl tells you what line/file it happen at. I'd suggest you have a look in Perl sources, especially what happens when there is adie
(for instance because of a division by 0). Not sure it will show you what you're looking for, but that's how I'd do it. – Smallsword__FILE__
,__LINE__
is stored at COP (PL_curcop
/PL_op
).__SUB__
is accessable as OP->cv->name... The question is not about how to access this data, but about accessing this data through some special interface – AnaplastyCopFILE
andCopLINE
macros are not what you are looking for? (sorry if I don't quite understand your question; I don't write XS code, I just play with Perl sources now and then) – Smallswordcaller
does it. – Rooker