B::Hooks::OP::Check::EntersubForCV - Invoke callbacks on construction of entersub OPs for certain CVs
sub foo {} use B::Hooks::OP::Check::EntersubForCV \&foo => sub { warn "entersub for foo() being compiled" }; foo(); # callback is invoked when this like is compiled no B::Hooks::OP::Check::EntersubForCV \&foo; foo(); # callback isn't invoked
#include "hook_op_check_entersubforcv.h" STATIC OP * my_callback (pTHX_ OP *op, CV *cv, void *user_data) { /* ... */ return op; } hook_op_check_id id; /* register callback */ id = hook_op_check_entersubforcv (cv, my_callback, NULL); /* unregister */ hook_op_check_entersubforcv_remove (id);
use B::Hooks::OP::Check::EntersubForCV \&code => \&handler; # or my $id = B::Hooks::OP::Check::EntersubForCV::register(\&code => \&handler);
Register handler to be executed when an entersub opcode for the CV code points to is compiled.
handler
code
When using register an id that can be used for later removal of the handler using unregister is returned.
register
unregister
no B::Hooks::OP::Check::EntersubForCV \&code; # or B::Hooks::OP::Check::EntersubForCV::unregister($id);
Stop calling the registered handler for code for all entersubs after this.
The type the handlers need to implement.
Register the callback cb to be called when an entersub opcode for cv is compiled. user_data will be passed to the callback as the last argument.
cb
cv
user_data
Returns an id that can be used to remove the handler using hook_op_check_entersubforcv_remove.
hook_op_check_entersubforcv_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, 2009 Florian Ragwitz
Copyright (c) 2011, 2012, 2017 Andrew Main (Zefram)
This module is free software.
You may distribute this code under the same terms as Perl itself.
To install B::Hooks::OP::Check::EntersubForCV, copy and paste the appropriate command in to your terminal.
cpanm
cpanm B::Hooks::OP::Check::EntersubForCV
CPAN shell
perl -MCPAN -e shell install B::Hooks::OP::Check::EntersubForCV
For more information on module installation, please visit the detailed CPAN module installation guide.