if (gv && isGV_with_GP(gv))
cv = GvCV(gv);
- if (!cv)
+ if (!cv || (!CvROOT(cv) && !CvXSUB(cv)))
DIE(aTHX_ "No DB::DB routine defined");
if (CvDEPTH(cv) >= 1 && !(PL_debug & DEBUG_DB_RECURSE_FLAG))
# This test depends on t/lib/Devel/switchd*.pm.
-plan(tests => 8);
+plan(tests => 9);
my $r;
stderr => 1,
),
qr/^No DB::DB routine defined/,
- "No crash when DB::DB isn't actually defined",
+ "No crash when *DB::DB exists but not &DB::DB",
+);
+like(
+ runperl(
+ switches => [ '-Ilib' ],
+ prog => 'sub DB::DB; BEGIN { $^P = 0x22; } for(0..9){ warn }',
+ stderr => 1,
+ ),
+ qr/^No DB::DB routine defined/,
+ "No crash when &DB::DB exists but isn't actually defined",
);