1B::Hooks::OP::Check::EnUtseerrsuCboFnotrrCiVb(u3t)ed PerBl::DHoocoukmse:n:tOaPt:i:oCnheck::EntersubForCV(3)
2
3
4

NAME

6       B::Hooks::OP::Check::EntersubForCV - Invoke callbacks on construction
7       of entersub OPs for certain CVs
8

SYNOPSIS

10   From Perl
11           sub foo {}
12
13           use B::Hooks::OP::Check::EntersubForCV
14               \&foo => sub { warn "entersub for foo() being compiled" };
15
16           foo(); # callback is invoked when this like is compiled
17
18           no B::Hooks::OP::Check::EntersubForCV \&foo;
19
20           foo(); # callback isn't invoked
21
22   From C/XS
23           #include "hook_op_check_entersubforcv.h"
24
25           STATIC OP *
26           my_callback (pTHX_ OP *op, CV *cv, void *user_data) {
27               /* ... */
28               return op;
29           }
30
31           hook_op_check_id id;
32
33           /* register callback */
34           id = hook_op_check_entersubforcv (cv, my_callback, NULL);
35
36           /* unregister */
37           hook_op_check_entersubforcv_remove (id);
38

DESCRIPTION

Perl API

41   import / register
42           use B::Hooks::OP::Check::EntersubForCV
43               \&code => \&handler;
44
45           # or
46           my $id = B::Hooks::OP::Check::EntersubForCV::register(\&code => \&handler);
47
48       Register "handler" to be executed when an entersub opcode for the CV
49       "code" points to is compiled.
50
51       When using "register" an id that can be used for later removal of the
52       handler using "unregister" is returned.
53
54   unimport / unregister
55           no B::Hooks::OP::Check::EntersubForCV \&code;
56
57           # or
58           B::Hooks::OP::Check::EntersubForCV::unregister($id);
59
60       Stop calling the registered handler for "code" for all entersubs after
61       this.
62

C API

64   TYPES
65       OP *(*hook_op_check_entersubforcv_cb) (pTHX_ OP *, CV *, void *)
66
67       The type the handlers need to implement.
68
69   FUNCTIONS
70       hook_op_check_id hook_op_check_entersubforcv (CV *cv,
71       hook_op_check_entersubforcv_cb cb, void *user_data)
72
73       Register the callback "cb" to be called when an entersub opcode for
74       "cv" is compiled. "user_data" will be passed to the callback as the
75       last argument.
76
77       Returns an id that can be used to remove the handler using
78       "hook_op_check_entersubforcv_remove".
79
80       void *hook_op_check_entersubforcv_remove (hook_op_check_id id)
81
82       Remove a previously registered handler referred to by "id".
83
84       Returns the user data that was associated with the handler.
85

SEE ALSO

87       B::Hooks::OP::Check
88

AUTHOR

90       Florian Ragwitz <rafl@debian.org>
91
93       Copyright (c) 2008, 2009 Florian Ragwitz
94
95       Copyright (c) 2011, 2012, 2017 Andrew Main (Zefram)
96
97       This module is free software.
98
99       You may distribute this code under the same terms as Perl itself.
100
101
102
103perl v5.36.0                      2023-01-B2:0:Hooks::OP::Check::EntersubForCV(3)
Impressum