diff options
author | Jesse Luehrs <doy@tozt.net> | 2013-07-21 11:45:43 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2013-07-21 11:47:50 -0400 |
commit | 5f0fb29dc02d2ad322afbba1056af6a96256f907 (patch) | |
tree | c30fffa8a40960191f54a63c17a928be1c704055 | |
parent | b35d374f486c3dcb1b2ba8ed5909903a9b34fc5b (diff) | |
download | parse-keyword-5f0fb29dc02d2ad322afbba1056af6a96256f907.tar.gz parse-keyword-5f0fb29dc02d2ad322afbba1056af6a96256f907.zip |
add a function to get the package of the currently compiling code
-rw-r--r-- | Keyword.xs | 7 | ||||
-rw-r--r-- | lib/Parse/Keyword.pm | 1 |
2 files changed, 8 insertions, 0 deletions
@@ -130,3 +130,10 @@ lex_read(len = 1) CODE: PL_curcop = &PL_compiling; lex_read_to(PL_parser->bufptr + len); + +SV * +compiling_package() + CODE: + RETVAL = newSVhek(HvNAME_HEK(CopSTASH(&PL_compiling))); + OUTPUT: + RETVAL diff --git a/lib/Parse/Keyword.pm b/lib/Parse/Keyword.pm index b1ec347..c981071 100644 --- a/lib/Parse/Keyword.pm +++ b/lib/Parse/Keyword.pm @@ -31,6 +31,7 @@ sub import { lex_read_space lex_read parse_block + compiling_package ); for my $helper (@helpers) { |