perlapi

Why callback is not called?

我是研究僧i 提交于 2019-12-22 08:22:35
问题 I have the example script from B::OPCheck module with modified PL_op_name to padsv use B::Generate; use B::OPCheck padsv => check => sub { my $op = shift; print "HERE"; }; my $x; 1; But callback is not called. When deparsing this program I can see this OP : $perl -Ilib -Iblib/arch -MO=Terse ~/tmp/xs.pl LISTOP (0x19828f0) leave [1] OP (0x1c27ef0) enter COP (0x1982938) nextstate OP (0x1982998) padsv [1] <<<< HERE IT IS COP (0x1c27f38) nextstate OP (0x1c27f98) null [5] Why callback is not called

Is there a way to access special tokens in perl from XS?

我怕爱的太早我们不能终老 提交于 2019-12-04 05:14:32
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. rurban You can look them up one by one in toke.c for the compile-time values: __PACKAGE__ => HvNAME(PL_curstash) or PL_curstname __FILE__ => CopFILE(PL_curcop) (at compile-time) __LINE__ => CopLINE(PL_curcop) (at compile-time) __SUB__ => PL_compcv If you need them at run-time look at the various

Is there a way to access special tokens in perl from XS?

≯℡__Kan透↙ 提交于 2019-11-30 18:05:04
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. rurban You can look them up one by one in toke.c for the compile-time values: __PACKAGE__ => HvNAME(PL_curstash) or PL_curstname __FILE__ => CopFILE(PL_curcop) (at compile-time) __LINE__ => CopLINE(PL_curcop) (at compile-time) __SUB__ => PL_compcv If you need them at run-time look at the various

Is there a way to access special tokens in perl from XS?

天涯浪子 提交于 2019-11-30 02:04:55
问题 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. 回答1: You can look them up one by one in toke.c for the compile-time values: __PACKAGE__ => HvNAME(PL_curstash) or PL_curstname __FILE__ => CopFILE(PL_curcop) (at compile-time) __LINE__ =>