B::Hooks::OP::Check - Wrap OP check callbacks
# include "hook_op_check.h" STATIC OP *my_const_check_op (pTHX_ OP *op, void *user_data) { /* ... */ return op; } STATIC hook_op_check_id my_hook_id = 0; void setup () CODE: my_hook_id = hook_op_check (OP_CONST, my_const_check_op, NULL); void teardown () CODE: hook_op_check_remove (OP_CONST, my_hook_id);
This module provides a c api for XS modules to hook into the callbacks of PL_check.
PL_check
ExtUtils::Depends is used to export all functions for other XS modules to use. Include the following in your Makefile.PL:
my $pkg = ExtUtils::Depends->new('Your::XSModule', 'B::Hooks::OP::Check'); WriteMakefile( ... # your normal makefile flags $pkg->get_makefile_vars, );
Your XS module can now include hook_op_check.h.
hook_op_check.h
Type that callbacks need to implement.
Type to identify a callback.
Register the callback cb to be called after the PL_check function for opcodes of the given type. user_data will be passed to the callback as the last argument. Returns an id that can be used to remove the callback later on.
cb
type
user_data
Remove the callback identified by id. Returns the userdata the callback had.
id
Florian Ragwitz <rafl@debian.org>
Copyright (c) 2008 Florian Ragwitz
Copyright (c) 2011, 2017 Andrew Main (Zefram)
This module is free software.
You may distribute this code under the same terms as Perl itself.
To install B::Hooks::OP::Check, copy and paste the appropriate command in to your terminal.
cpanm
cpanm B::Hooks::OP::Check
CPAN shell
perl -MCPAN -e shell install B::Hooks::OP::Check
For more information on module installation, please visit the detailed CPAN module installation guide.