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 # include "hook_op_check.h"
10
11 STATIC OP *my_const_check_op (pTHX_ OP *op, void *user_data) {
12 /* ... */
13 return op;
14 }
15
16 STATIC hook_op_check_id my_hook_id = 0;
17
18 void
19 setup ()
20 CODE:
21 my_hook_id = hook_op_check (OP_CONST, my_const_check_op, NULL);
22
23 void
24 teardown ()
25 CODE:
26 hook_op_check_remove (OP_CONST, my_hook_id);
27
29 This module provides a c api for XS modules to hook into the callbacks
30 of "PL_check".
31
32 ExtUtils::Depends is used to export all functions for other XS modules
33 to use. Include the following in your Makefile.PL:
34
35 my $pkg = ExtUtils::Depends->new('Your::XSModule', 'B::Hooks::OP::Check');
36 WriteMakefile(
37 ... # your normal makefile flags
38 $pkg->get_makefile_vars,
39 );
40
41 Your XS module can now include "hook_op_check.h".
42
44 typedef OP *(*hook_op_check_cb) (pTHX_ OP *, void *);
45 Type that callbacks need to implement.
46
47 typedef UV hook_op_check_id
48 Type to identify a callback.
49
51 hook_op_check_id hook_op_check (opcode type, hook_op_check_cb cb, void
52 *user_data)
53 Register the callback "cb" to be called after the "PL_check" function
54 for opcodes of the given "type". "user_data" will be passed to the
55 callback as the last argument. Returns an id that can be used to remove
56 the callback later on.
57
58 void *hook_op_check_remove (opcode type, hook_op_check_id id)
59 Remove the callback identified by "id". Returns the userdata the
60 callback had.
61
63 Florian Ragwitz <rafl@debian.org>
64
66 Copyright (c) 2008 Florian Ragwitz
67
68 This module is free software.
69
70 You may distribute this code under the same terms as Perl itself.
71
72
73
74perl v5.12.4 2011-09-10 B::Hooks::OP::Check(3)