logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

B::Hooks::OP::Check - Wrap OP check callbacks

Author

Florian Ragwitz <rafl@debian.org>

Contributors

• Karen Etheridge <ether@cpan.org> • Zefram <zefram@fysh.org> • Alexandr Ciornii <alexchorny@gmail.com>

Description

This module provides a C API for XS modules to hook into the callbacks of "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".

Functions

hook_op_check_idhook_op_check(opcodetype,hook_op_check_cbcb,void*user_data) 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. void*hook_op_check_remove(opcodetype,hook_op_check_idid) Remove the callback identified by "id". Returns the user_data that the callback had.

Name

B::Hooks::OP::Check - Wrap OP check callbacks

Support

Bugs may be submitted through the RT bug tracker <https://rt.cpan.org/Public/Dist/Display.html?Name=B- Hooks-OP-Check> (or bug-B-Hooks-OP-Check@rt.cpan.org <mailto:bug-B-Hooks-OP-Check@rt.cpan.org>).

Synopsis

# 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);

Types

typedefOP*(*hook_op_check_cb)(pTHX_OP*,void*); Type that callbacks need to implement. typedefUVhook_op_check_id Type to identify a callback.

Version

version 0.22

See Also