1B::Hooks::OP::Check::StUassehrChCaonngter(i3b)uted PerlBD:o:cHuomoeknst:a:tOiPo:n:Check::StashChange(3)
2
3
4

NAME

6       B::Hooks::OP::Check::StashChange - Invoke callbacks when the stash code
7       is being compiled in changes
8

SYNOPSIS

10   From Perl
11           package Foo;
12
13           use B::Hooks::OP::Check::StashChange;
14
15           our $id = B::Hooks::OP::Check::StashChange::register(sub {
16               my ($new, $old) = @_;
17               warn "${old} -> ${new}";
18           });
19
20           package Bar; # "Foo -> Bar"
21
22           B::Hooks::OP::Check::StashChange::unregister($Foo::id);
23
24           package Moo; # callback not invoked
25
26   From C/XS
27           #include "hooks_op_check_stashchange.h"
28
29           STATIC OP *
30           my_callback (pTHX_ OP *op, char *new_stash, char *old_stash, void *user_data) {
31               /* ... */
32               return op;
33           }
34
35           UV id;
36
37           /* register callback */
38           id = hook_op_check_stashchange (cv, my_callback, NULL);
39
40           /* unregister */
41           hook_op_check_stashchange_remove (id);
42

DESCRIPTION

Perl API

45   register
46           B::Hooks::OP::Check::
47
48           # or
49           my $id = B::Hooks::OP::Check::StashChange::register(\&callback);
50
51       Register "callback" when an opcode is being compiled in a different
52       namespace than the previous one.
53
54       An id that can be used for later removal of the handler using
55       "unregister" is returned.
56
57   unregister
58           B::Hooks::OP::Check::StashChange::unregister($id);
59
60       Disable the callback referenced by $id.
61

C API

63   TYPES
64       OP *(*hook_op_check_stashchange_cb) (pTHX_ OP *op, const char
65       *new_stash, const char *old_stash, void *user_data)
66
67       The type the callbacks need to implement.
68
69   FUNCTIONS
70       UV hook_op_check_stashchange (hook_op_check_stashchange_cb cb, void
71       *user_data)
72
73       Register the callback "cb" to be when an opcode is compiled in a
74       different namespace than the previous. "user_data" will be passed to
75       the callback as the last argument.
76
77       Returns an id that can be used to remove the handler using
78       "hook_op_check_stashchange_remove".
79
80       void *hook_op_check_stashchange_remove (UV 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 Florian Ragwitz
94
95       This module is free software.
96
97       You may distribute this code under the same terms as Perl itself.
98
99
100
101perl v5.32.1                      2021-01-26B::Hooks::OP::Check::StashChange(3)
Impressum