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

Re: Pre-RFC: check if we're running under the debugger

Thread Previous | Thread Next
From:
Ricardo Signes
Date:
February 23, 2022 13:37
Subject:
Re: Pre-RFC: check if we're running under the debugger
Message ID:
d361263a-c0df-49a6-b160-3d2f0612a888@beta.fastmail.com
On Wed, Feb 23, 2022, at 8:13 AM, Ovid via perl5-porters wrote:
> On Wednesday, 23 February 2022, 14:03:47 CET, Leon Timmermans <fawaka@gmail.com> wrote:
> > You can check if $^P is not 0?
> 
> I never knew about that particular variable. If it's stable and guaranteed (I would assume yes to both), it would be nice to add that to the perldebug POD (at least on v5.26 I don't see it in there).
> 
> If that's considered the best canonical approach, I'm happy to submit a PR.

I think that's the best way.

This tells you that "something is doing something with debug facilities," which may not mean that perl5db.pl is being used to debug.  For that, maybe you'd look at $DB::header, but this is a losing battle.  $^P tells you that the -d switch was passed, more or less.

-- 
rjbs
Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About