-
-
22 Aug 2020 23:33:12 UTC
- Distribution: B-Hooks-OP-Check-LeaveEval
- Module version: v0.0.4
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Repository
- Issues
- Testers
- Kwalitee
Bus factor: 1- License: perl_5
- Perl: v5.10.1
- Activity
24 month- Tools
- Download (63.65KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
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 viause
orrequire
) or aneval
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.
Module Install Instructions
To install B::Hooks::OP::Check::LeaveEval, copy and paste the appropriate command in to your terminal.
cpanm B::Hooks::OP::Check::LeaveEval
perl -MCPAN -e shell install B::Hooks::OP::Check::LeaveEval
For more information on module installation, please visit the detailed CPAN module installation guide.