B::Hooks::EndOfScope - Execute code after a scope finished compilation
on_scope_end { ... };
This module allows you to execute code when perl finished compiling the surrounding scope.
on_scope_end { ... }; on_scope_end $code;
Registers $code to be executed after the surrounding scope has been compiled.
$code
This is exported by default. See Sub::Exporter on how to customize it.
While Variable::Magic has access to some very dark sorcery to make it possible to throw an exception from within a callback, the pure-perl implementation does not have access to these hacks. Therefore, what would have been a compile-time exception is instead converted to a warning, and your execution will continue as if the exception never happened.
To explicitly request an XS (or PP) implementation one has two choices. Either to import from the desired implementation explicitly:
use B::Hooks::EndOfScope::XS or use B::Hooks::EndOfScope::PP
or by setting $ENV{B_HOOKS_ENDOFSCOPE_IMPLEMENTATION} to either XS or PP.
$ENV{B_HOOKS_ENDOFSCOPE_IMPLEMENTATION}
XS
PP
Sub::Exporter
Variable::Magic
Florian Ragwitz <rafl@debian.org>
Peter Rabbitson <ribasushi@cpan.org>
This software is copyright (c) 2012 by Florian Ragwitz.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install B::Hooks::EndOfScope, copy and paste the appropriate command in to your terminal.
cpanm
cpanm B::Hooks::EndOfScope
CPAN shell
perl -MCPAN -e shell install B::Hooks::EndOfScope
For more information on module installation, please visit the detailed CPAN module installation guide.