develooper Front page | perl.perl5.porters | Postings from January 2022

Re: Broken stack traces from use statements.

Thread Previous | Thread Next
Leon Timmermans
January 15, 2022 04:18
Re: Broken stack traces from use statements.
Message ID:
commit f1e3b0011e4342270adb5bc9860777e8eba1aa70
Author: Leon Timmermans <>
Date:   Sat Jan 15 00:45:40 2022 +0100

    Make t/53lean_startup.t robust wrt stacktrace details
    This test checks if none of DBIC is loading anything unexpected. It
    contains logic to skip over indirect loaders such as base, parent and
    Class::C3::Componentised. However, this erroneously skips over direct
    dependencies of such classes. In particular, it assigns the MRO::Compat
    dependency in Class::C3::Componentised to whatever class it thinks it
    loads CCC. Before ad89278 this worked out fine, because it would be
    assigned to main, which while meaningless isn't part of DBIx::Class so
    ignored. After ad89278, it's assigned to the class that loads CCC, which
    is DBIx::Class::Componentised, which is part of DBIC, and hence fails
    the test.
    This test will cause it to not skip on for any BEGIN blocks inside an
    indirect loader, therefor the MRO::Compat dependency will correctly be
    assigned to Class::C3::Componentised.

diff --git t/53lean_startup.t t/53lean_startup.t
index 9a4ef858..843c72b4 100644
--- t/53lean_startup.t
+++ t/53lean_startup.t
@@ -30,7 +30,7 @@ BEGIN {
         # exclude our test suite, known "module require-rs" and eval frames
         $caller[1] =~ /^ t [\/\\] /x
-        $caller[0] =~ /^ (?: base | parent | Class::C3::Componentised | Module::Inspector | Module::Runtime ) $/x
+        $caller[0] =~ /^ (?: base | parent | Class::C3::Componentised | Module::Inspector | Module::Runtime ) $/x && $caller[3] !~ m/::BEGIN$/
         $caller[3] eq '(eval)',

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About