B::Hooks::OP::Check::LeaveEval - call a subroutine when new code finishes compiling
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
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.
leaveeval
use
require
eval
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).
$id
B::Hooks::OP::Check::LeaveEval::unregister($id);
Remove the callback referenced by $id.
Szymon Nieznański <s.nez@member.fsf.org>
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.
To install B::Hooks::OP::Check::LeaveEval, copy and paste the appropriate command in to your terminal.
cpanm
cpanm B::Hooks::OP::Check::LeaveEval
CPAN shell
perl -MCPAN -e shell install B::Hooks::OP::Check::LeaveEval
For more information on module installation, please visit the detailed CPAN module installation guide.