B::Hooks::OP::Check::StashChange - Invoke callbacks when the stash code is being compiled in changes
package Foo; use B::Hooks::OP::Check::StashChange; our $id = B::Hooks::OP::Check::StashChange::register(sub { my ($new, $old) = @_; warn "${old} -> ${new}"; }); package Bar; # "Foo -> Bar" B::Hooks::OP::Check::StashChange::unregister($Foo::id); package Moo; # callback not invoked
#include "hooks_op_check_stashchange.h" STATIC OP * my_callback (pTHX_ OP *op, char *new_stash, char *old_stash, void *user_data) { /* ... */ return op; } UV id; /* register callback */ id = hook_op_check_stashchange (cv, my_callback, NULL); /* unregister */ hook_op_check_stashchange_remove (id);
B::Hooks::OP::Check:: # or my $id = B::Hooks::OP::Check::StashChange::register(\&callback);
Register callback when an opcode is being compiled in a different namespace than the previous one.
callback
An id that can be used for later removal of the handler using unregister is returned.
unregister
B::Hooks::OP::Check::StashChange::unregister($id);
Disable the callback referenced by $id.
$id
The type the callbacks need to implement.
Register the callback cb to be when an opcode is compiled in a different namespace than the previous. user_data will be passed to the callback as the last argument.
cb
user_data
Returns an id that can be used to remove the handler using hook_op_check_stashchange_remove.
hook_op_check_stashchange_remove
Remove a previously registered handler referred to by id.
id
Returns the user data that was associated with the handler.
B::Hooks::OP::Check
Florian Ragwitz <rafl@debian.org>
Copyright (c) 2008 Florian Ragwitz
This module is free software.
You may distribute this code under the same terms as Perl itself.
To install B::Hooks::OP::Check::StashChange, copy and paste the appropriate command in to your terminal.
cpanm
cpanm B::Hooks::OP::Check::StashChange
CPAN shell
perl -MCPAN -e shell install B::Hooks::OP::Check::StashChange
For more information on module installation, please visit the detailed CPAN module installation guide.