Subject: | ->setup doesn’t fully work without BEGIN |
See <https://rt.cpan.org/Ticket/Display.html?id=76437>.
Catalyst::setup uses B::Hooks::EndOfScope::on_scope_end to finish some things up. But
on_scope_end only works reliably when there is a BEGIN block on the call stack. It will only be
triggered when that BEGIN block exits. This is because on_scope_end deals with *compile-time*
scopes.
Due to a Perl scoping bug, fixed in commit f45b078, this used to work if ->setup was called
inside a module’s main CV, because compile-time and run-time scopes were getting muddled
up.
If this is supposed to apply to the end of the caller’s run-time scope, then perhaps Scope::Upper
is what you want, rather than B::Hooks::EndOfScope.