Sub::Op - Install subroutines as opcodes.
VERSION
- Version 0.01
+ Version 0.02
SYNOPSIS
In your XS file :
BOOT:
{
sub_op_config_t c;
- c.name = "reftype";
- c.len = sizeof("reftype")-1;
- c.pp = scalar_util_reftype;
- c.check = 0;
- c.ud = NULL;
+ c.name = "reftype";
+ c.namelen = sizeof("reftype")-1;
+ c.pp = scalar_util_reftype;
+ c.check = 0;
+ c.ud = NULL;
sub_op_register(aTHX_ &c);
}
The name of the subroutine you want to replace. Allowed to be
static.
- * "STRLEN len"
+ * "STRLEN namelen"
"name"'s length, in bytes.
See the t/Sub-Op-LexicalSub directory that implements a complete
example.
+CAVEATS
+ Preexistent definitions of a sub whose name is handled by Sub::Op are
+ restored at the end of the lexical scope in which the module is used.
+ But if you define a sub in the scope of action of Sub::Op with a name
+ that is currently being replaced, the new declaration will be
+ obliterated at the scope end.
+
+ Function calls without parenthesis inside an "eval STRING" in the scope
+ of the pragma won't be replaced. I know a few ways of fixing this, but
+ I've not yet decided on which.
+
DEPENDENCIES
perl 5.10.
SEE ALSO
subs::auto.
+ B::Hooks::XSUB::CallAsOp provides a C API to declare XSUBs that
+ effectively call a specific PP function. Thus, it allows you to write
+ XSUBs with the PP stack conventions used for implementing perl core
+ keywords. There's no opcode replacement and no parsing hacks.
+
B::Hooks::OP::Check::EntersubForCV.
AUTHOR