5

In Perl, special tokens like __PACKAGE__, __SUB__, __FILE__, __LINE__ exists and are available from the script.

I may get a value of __PACKAGE__ from XS as HvNAME( PL_currstash ), I suppose. How do I access the others?

Is there a special interface to access all of them from XS? Like: CTX->package, CTX->sub, etc.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
  • 3
    I see you deleted your answer. Personally, I would have found it very useful if you would have updated it. I use XS a fair amount and I've been curious about this myself. When you said you had it resolved, I was really hoping you'd share your findings. – stevieb Aug 05 '17 at 19:27
  • @stevieb Basically I found this question on stack overflow and it didn't have an answer, and i didn't have enough repu to offer a bounty, so I posted this question again. I found a basic idea of how it is working in the comments. I'm providing a link to the original question: https://stackoverflow.com/questions/42629915/is-there-a-way-to-access-special-tokens-in-perl-from-xs –  Aug 05 '17 at 19:40
  • 2
    So you completely and literally copied someone elses question, came up with an answer based on the comments, yet you don't provide an answer that you found suitable for *either* question? Please. Have some more respect than that! If your solution answers the question, answer both of them. – stevieb Aug 05 '17 at 19:46
  • @stevieb I didn't find the answer. I just said I got a very basic idea of what it might be. I don't even know if it's correct. As I said earlier, no one had answered that question, and I just tried to make it out using the comments posted. I haven't found anything substantial enough to post an answer to either of the questions. Also, had I found the complete solution, I would have posted the answer myself –  Aug 05 '17 at 19:51
  • @stevieb Else I would have deleted the question all together since it is a duplicate, if I had got the answer, and then posted that answer to the original question –  Aug 05 '17 at 19:52
  • 1
    Ok, I apologize then for coming off as a bit aggressive. I understand now. In your answer that you deleted, you did say you had it resolved, so that was the basis for my understanding. – stevieb Aug 05 '17 at 19:53
  • 1
    @stevieb no it's fine. misunderstandings happen. also, i'll post the answer as soon as I find it –  Aug 05 '17 at 19:55

0 Answers0