NAME
B::Hooks::OP::Check::LeaveEval - call a subroutine when new code finishes compiling
SYNOPSIS
use B::Hooks::OP::Check::LeaveEval;
my $id = B::Hooks::OP::Check::LeaveEval::register(sub { print "New code!\n" });
require Foo;                 # will print "New code!"
eval 'sub Foo::bar { ... }'; # will print "New code!"
B::Hooks::OP::Check::LeaveEval::unregister($id);
require Bar;                 # won't print
DESCRIPTION
This module allows to hook into every execution of the leaveeval opcode, this happens when a new module is finished loading (either via use or require) or an eval is done. Essentially, this means it will be called whenever new code is finished compling.
FUNCTIONS
register
my $id = B::Hooks::OP::Check::LeaveEval::register(sub { ... });
Register a callback for leaveeval executions. The callback will receive no arguments and its return value will be ignored.
The returned $id can be used to remove the callback later (see unregister).
unregister
B::Hooks::OP::Check::LeaveEval::unregister($id);
Remove the callback referenced by $id.
AUTHOR
Szymon Nieznański <s.nez@member.fsf.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2020 by Szymon Nieznański.
This is free software; you can redistribute it and/or modify it under the same terms as Perl itself.