develooper Front page | perl.perl5.porters | Postings from October 2003

Re: How to tell if Perl has -DDEBUGGING?

Thread Previous | Thread Next
From:
Steve Hay
Date:
October 24, 2003 08:58
Subject:
Re: How to tell if Perl has -DDEBUGGING?
Message ID:
3F994C9E.7090502@uk.radan.com
Rafael Garcia-Suarez wrote:

>Casey West wrote:
>  
>
>>It was Friday, October 24, 2003 when Steve Hay took the soap box, saying:
>>: Is there any way for a Perl module to tell that it is being run by a 
>>: Perl that was built with -DDEBUGGING enabled?
>>
>>Here's my shot.
>>
>>$ /usr/local/perl/perl/bin/perl5.9.0 -MData::Dumper \
>>    -MConfig -le'print Dumper \%Config' | grep -i debug
>>          'config_arg2' => '-DDEBUGGING',
>>          'config_args' => '-Dusedevel -DDEBUGGING -des -Dprefix=/usr/local/perl/perl',
>>
>>    
>>
>
>You don't have it in $Config{ccflags} ? how weird.
>  
>
On my Windows machine I get this:

C:\Radview\Radan\Filter>C:\perl5d\bin\perl -MData::Dumper -MConfig -le 
"print Dumper \%Config" | \cygwin\bin\grep -i debug
          'ccflags' => '-nologo -Gf -W3 -Od -MD -Zi -DDEBUGGING -DWIN32 
-D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT  -DPERL_DEBUGGING_MSTATS 
-DUSE_PERLIO -DPERL_MSVCRT_READFIX',
          'lddlflags' => '-dll -nologo -nodefaultlib -debug  
-libpath:"C:\\perl5d\\lib\\CORE"  -machine:x86',
          'ldflags' => '-nologo -nodefaultlib -debug  
-libpath:"C:\\perl5d\\lib\\CORE"  -machine:x86',
          'optimize' => '-Od -MD -Zi -DDEBUGGING',

which is all well and good, but some devious miscreant could easily edit 
their Config.pm file to lie about whether the Perl has DEBUGGING or not.

Is there no way for Perl itself to tell us?

The end of the "perl -V" output contains this:

    Characteristics of this binary (from libperl):
      Compile-time options: DEBUGGING
      Built under MSWin32
      Compiled at Oct 24 2003 15:50:11

That doesn't come from Config.pm.  Instead, as it says, it comes from 
Perl (libperl) itself.  That's what I want.  Can I get at *that* 
DEBUGGING setting (other than by the obvious and undesirable means of 
doing a "perl -V" system call and parsing the output)?

- Steve


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