B::Hoo...bForCV(3pm)
π NAME π
B::Hooks::OP::Check::EntersubForCV β bestie, this one lets you invoke callbacks on construction of entersub OPs for certain CVs. no cap. π¦
β¨ SYNOPSIS β¨
π From Perl
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
π From C/XS
#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);
πΈ DESCRIPTION πΈ
Perl API
π import / register
use B::Hooks::OP::Check::EntersubForCV
\&code => \&handler;
# or
my $id = B::Hooks::OP::Check::EntersubForCV::register(\&code => \&handler);
Okay so what this does: you register a "handler", and that handler gets executed when an entersub opcode for the CV that "code" points to gets compiled. it's giving "notice me when this gets built" energy.
And when you go through register instead? it hands you back an id, and you can use that id later to remove the handler with unregister. keep it in your pocket, bestie. π«Ά
π unimport / unregister
no B::Hooks::OP::Check::EntersubForCV \&code;
# or
B::Hooks::OP::Check::EntersubForCV::unregister($id);
This one stops calling the registered handler for "code" for all entersubs after this point. like, goodbye, we're done, no more texts. π
C API
π¦ TYPES
OP *(*hook_op_check_entersubforcv_cb) (pTHX_ OP *, CV *, void *)
This is the type that the handlers need to implement. you gotta match the signature, periodt.
π¦ FUNCTIONS
hook_op_check_id hook_op_check_entersubforcv (CV *cv,
hook_op_check_entersubforcv_cb cb, void *user_data)
Register the callback "cb" to be called when an entersub opcode for "cv" is compiled. and "user_data"? that gets passed to the callback as the last argument, so it can carry whatever you want with it. iconic behavior honestly.
Returns an id that you can use to remove the handler using hook_op_check_entersubforcv_remove.
void *hook_op_check_entersubforcv_remove (hook_op_check_id id)
Remove a previously registered handler referred to by "id".
And it returns the user data that was associated with the handler. giving it back to you like a good friend returning your hoodie. π§
π SEE ALSO π
B::Hooks::OP::Check
π AUTHOR π
Florian Ragwitz <rafl@debian.org>
π COPYRIGHT AND LICENSE π
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.
okay that's the whole page bestie, you ate it π and just so you know the receipts: this is perl v5.42.3, dated 2026-08-20, and it lives in the manual as B::Hoo...bForCV(3pm) (yes that's the truncated title, she's mysterious like that β¨). go compile something iconic π πΈ
π¦ where this page comes from
- ubuntu stonking: libb-hooks-op-check-entersubforcv-perl 0.10-3build3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms