Revision history for Sub-Op
+0.02 2010-01-08 21:40 UTC
+ + Chg : INCOMPATIBLE CHANGE : The "len" member of the sub_op_config_t
+ struct was renamed to "namelen".
+ + Fix : Handle existing prototyped subs and constants.
+ + Fix : Less symbols and packages should be vivified under B::.
+ + Tst : Test monkeypatching of B::OP and B::Deparse.
+ + Upd : Bump Variable::Magic dependency to 0.40.
+
0.01 2010-01-02 21:10 UTC
First version, released on an unsuspecting world.
--- #YAML:1.0
name: Sub-Op
-version: 0.01
+version: 0.02
abstract: Install subroutines as opcodes.
author:
- Vincent Pit <perl@profvince.com>
ExtUtils::MakeMaker: 0
File::Spec: 0
POSIX: 0
+ Scalar::Util: 0
Test::More: 0
- Variable::Magic: 0.39
+ Variable::Magic: 0.40
requires:
B::Hooks::EndOfScope: 0
DynaLoader: 0
perl: 5.01
- Variable::Magic: 0.39
+ Scalar::Util: 0
+ Variable::Magic: 0.40
resources:
bugtracker: http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Sub-Op
homepage: http://search.cpan.org/dist/Sub-Op/
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