diff options
author | Jesse Luehrs <doy@tozt.net> | 2013-07-10 14:17:52 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2013-07-10 14:17:52 -0400 |
commit | 818958abaf7ad4f86101f88e74caf688b23be9a3 (patch) | |
tree | 0dca925e22a60be5b63405e49c531d1ca93d9d2c /Lexical.xs | |
parent | a571380fee1cfd63ba816842df95777ac9b2b0cb (diff) | |
download | exporter-lexical-818958abaf7ad4f86101f88e74caf688b23be9a3.tar.gz exporter-lexical-818958abaf7ad4f86101f88e74caf688b23be9a3.zip |
initial (non-working) implementation
Diffstat (limited to 'Lexical.xs')
-rw-r--r-- | Lexical.xs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Lexical.xs b/Lexical.xs new file mode 100644 index 0000000..1ae3923 --- /dev/null +++ b/Lexical.xs @@ -0,0 +1,26 @@ +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + +MODULE = Exporter::Lexical PACKAGE = Exporter::Lexical + +PROTOTYPES: DISABLE + +void +lexical_import(SV *name, CV *cv) + CODE: + PADLIST *pl; + PADOFFSET off; + if (!PL_compcv) + Perl_croak(aTHX_ + "lexical_import can only be called at compile time"); + pl = CvPADLIST(PL_compcv); + ENTER; + SAVESPTR(PL_comppad_name); PL_comppad_name = PadlistNAMES(pl); + SAVESPTR(PL_comppad); PL_comppad = PadlistARRAY(pl)[1]; + SAVESPTR(PL_curpad); PL_curpad = PadARRAY(PL_comppad); + off = pad_add_name_sv(sv_2mortal(newSVpvf("&%"SVf,name)), + padadd_STATE, 0, 0); + SvREFCNT_dec(PL_curpad[off]); + PL_curpad[off] = SvREFCNT_inc(cv); + LEAVE; |