B-Hooks-OP-Check-EntersubForCV

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

NAME
    B::Hooks::OP::Check::EntersubForCV - Invoke callbacks on construction of
    entersub OPs for certain CVs

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);

    Register "handler" to be executed when an entersub opcode for the CV
    "code" points to is compiled.

    When using "register" an id that can be used for later removal of the
    handler using "unregister" is returned.

  unimport / 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.

C API
  TYPES
   OP *(*hook_op_check_entersubforcv_cb) (pTHX_ OP *, CV *, void *)
    The type the handlers need to implement.



( run in 0.515 second using v1.01-cache-2.11-cpan-f56aa216473 )