1B::Hooks::OP::Check(3)User Contributed Perl DocumentationB::Hooks::OP::Check(3)
2
3
4
6 B::Hooks::OP::Check - Wrap OP check callbacks
7
9 version 0.22
10
12 # include "hook_op_check.h"
13
14 STATIC OP *my_const_check_op (pTHX_ OP *op, void *user_data) {
15 /* ... */
16 return op;
17 }
18
19 STATIC hook_op_check_id my_hook_id = 0;
20
21 void
22 setup ()
23 CODE:
24 my_hook_id = hook_op_check (OP_CONST, my_const_check_op, NULL);
25
26 void
27 teardown ()
28 CODE:
29 hook_op_check_remove (OP_CONST, my_hook_id);
30
32 This module provides a C API for XS modules to hook into the callbacks
33 of "PL_check".
34
35 ExtUtils::Depends is used to export all functions for other XS modules
36 to use. Include the following in your Makefile.PL:
37
38 my $pkg = ExtUtils::Depends->new('Your::XSModule', 'B::Hooks::OP::Check');
39 WriteMakefile(
40 ... # your normal makefile flags
41 $pkg->get_makefile_vars,
42 );
43
44 Your XS module can now include "hook_op_check.h".
45
47 typedef OP *(*hook_op_check_cb) (pTHX_ OP *, void *);
48 Type that callbacks need to implement.
49
50 typedef UV hook_op_check_id
51 Type to identify a callback.
52
54 hook_op_check_id hook_op_check (opcode type, hook_op_check_cb cb, void
55 *user_data)
56 Register the callback "cb" to be called after the "PL_check" function
57 for opcodes of the given "type". "user_data" will be passed to the
58 callback as the last argument. Returns an id that can be used to remove
59 the callback later on.
60
61 void *hook_op_check_remove (opcode type, hook_op_check_id id)
62 Remove the callback identified by "id". Returns the user_data that the
63 callback had.
64
66 Bugs may be submitted through the RT bug tracker
67 <https://rt.cpan.org/Public/Dist/Display.html?Name=B-Hooks-OP-Check>
68 (or bug-B-Hooks-OP-Check@rt.cpan.org <mailto:bug-B-Hooks-OP-
69 Check@rt.cpan.org>).
70
72 Florian Ragwitz <rafl@debian.org>
73
75 · Karen Etheridge <ether@cpan.org>
76
77 · Zefram <zefram@fysh.org>
78
79 · Alexandr Ciornii <alexchorny@gmail.com>
80
82 This software is copyright (c) 2008 by Florian Ragwitz.
83
84 This is free software; you can redistribute it and/or modify it under
85 the same terms as the Perl 5 programming language system itself.
86
87
88
89perl v5.32.0 2020-07-28 B::Hooks::OP::Check(3)