.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "B::Hooks::OP::Check::EntersubForCV 3pm" .TH B::Hooks::OP::Check::EntersubForCV 3pm 2024-01-10 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME B::Hooks::OP::Check::EntersubForCV \- Invoke callbacks on construction of entersub OPs for certain CVs .SH SYNOPSIS .IX Header "SYNOPSIS" .SS "From Perl" .IX Subsection "From Perl" .Vb 1 \& sub foo {} \& \& use B::Hooks::OP::Check::EntersubForCV \& \e&foo => sub { warn "entersub for foo() being compiled" }; \& \& foo(); # callback is invoked when this like is compiled \& \& no B::Hooks::OP::Check::EntersubForCV \e&foo; \& \& foo(); # callback isn\*(Aqt invoked .Ve .SS "From C/XS" .IX Subsection "From C/XS" .Vb 1 \& #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); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" .SH "Perl API" .IX Header "Perl API" .SS "import / register" .IX Subsection "import / register" .Vb 2 \& use B::Hooks::OP::Check::EntersubForCV \& \e&code => \e&handler; \& \& # or \& my $id = B::Hooks::OP::Check::EntersubForCV::register(\e&code => \e&handler); .Ve .PP Register \f(CW\*(C`handler\*(C'\fR to be executed when an entersub opcode for the CV \f(CW\*(C`code\*(C'\fR points to is compiled. .PP When using \f(CW\*(C`register\*(C'\fR an id that can be used for later removal of the handler using \f(CW\*(C`unregister\*(C'\fR is returned. .SS "unimport / unregister" .IX Subsection "unimport / unregister" .Vb 1 \& no B::Hooks::OP::Check::EntersubForCV \e&code; \& \& # or \& B::Hooks::OP::Check::EntersubForCV::unregister($id); .Ve .PP Stop calling the registered handler for \f(CW\*(C`code\*(C'\fR for all entersubs after this. .SH "C API" .IX Header "C API" .SS TYPES .IX Subsection "TYPES" \fIOP *(*hook_op_check_entersubforcv_cb) (pTHX_ OP *, CV *, void *)\fR .IX Subsection "OP *(*hook_op_check_entersubforcv_cb) (pTHX_ OP *, CV *, void *)" .PP The type the handlers need to implement. .SS FUNCTIONS .IX Subsection "FUNCTIONS" \fIhook_op_check_id hook_op_check_entersubforcv (CV *cv, hook_op_check_entersubforcv_cb cb, void *user_data)\fR .IX Subsection "hook_op_check_id hook_op_check_entersubforcv (CV *cv, hook_op_check_entersubforcv_cb cb, void *user_data)" .PP Register the callback \f(CW\*(C`cb\*(C'\fR to be called when an entersub opcode for \f(CW\*(C`cv\*(C'\fR is compiled. \f(CW\*(C`user_data\*(C'\fR will be passed to the callback as the last argument. .PP Returns an id that can be used to remove the handler using \&\f(CW\*(C`hook_op_check_entersubforcv_remove\*(C'\fR. .PP \fIvoid *hook_op_check_entersubforcv_remove (hook_op_check_id id)\fR .IX Subsection "void *hook_op_check_entersubforcv_remove (hook_op_check_id id)" .PP Remove a previously registered handler referred to by \f(CW\*(C`id\*(C'\fR. .PP Returns the user data that was associated with the handler. .SH "SEE ALSO" .IX Header "SEE ALSO" B::Hooks::OP::Check .SH AUTHOR .IX Header "AUTHOR" Florian Ragwitz .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright (c) 2008, 2009 Florian Ragwitz .PP Copyright (c) 2011, 2012, 2017 Andrew Main (Zefram) .PP This module is free software. .PP You may distribute this code under the same terms as Perl itself.