Skip to content

The Perl debugger does not honor 'use strict' for expression evaluation #22206

@hexcoder-

Description

@hexcoder-

Module: perl5db.pl or DB.pm

Description

When starting the debugger with
perl -Mstrict -wde 1

the "use strict" has no effect on subsequent expressions used with the x command (e.g for DB::eval):

x join('', BARE, WORD)
-> 0 'BAREWORD'

This is in contrast WRT the same setup in an oneliner:

perl -Mstrict -we "print join('', BARE, WORD)"
Bareword "BARE" not allowed while "strict subs" in use at -e line 1.
Bareword "WORD" not allowed while "strict subs" in use at -e line 1.
Execution of -e aborted due to compilation errors.

Steps to Reproduce

perl -Mstrict -wde 1
x join('', BARE, WORD)
gives
0 'BAREWORD'

Expected behavior

When use strict is in effect, BAREWORDs should be errors also in evaluated expressions for consistency.

Perl configuration

# perl -V output goes here
Summary of my perl5 (revision 5 version 38 subversion 0) configuration:

  Platform:
    osname=MSWin32
    osvers=10.0.17763.4499
    archname=MSWin32-x64-multi-thread
    uname='Win32 strawberry-perl 5.38.0.1 # 12:34:49 Thu July 06 2023 x64'
    config_args='undef'
    hint=recommended
    useposix=true
    d_sigaction=undef
    useithreads=define
    usemultiplicity=define
    use64bitint=define
    use64bitall=undef
    uselongdouble=undef
    usemymalloc=n
    default_inc_excludes_dot=define
  Compiler:
    cc='gcc'
    ccflags =' -DWIN32 -DWIN64 -DPERL_TEXTMODE_SCRIPTS -DMULTIPLICITY -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D__USE_MINGW_ANSI_STDIO -fwrapv -fno-strict-aliasing -mms-bitfields'
    optimize='-Os'
    cppflags='-DWIN32'
    ccversion=''
    gccversion='13.1.0'
    gccosandvers=''
    intsize=4
    longsize=4
    ptrsize=8
    doublesize=8
    byteorder=12345678
    doublekind=3
    d_longlong=define
    longlongsize=8
    d_longdbl=define
    longdblsize=16
    longdblkind=3
    ivtype='long long'
    ivsize=8
    nvtype='double'
    nvsize=8
    Off_t='long long'
    lseeksize=8
    alignbytes=8
    prototype=define
  Linker and Libraries:
    ld='g++'
    ldflags ='-s -L"C:\STRAWB~1.38_\perl\lib\CORE" -L"C:\STRAWB~1.38_\c\lib" -L"C:\STRAWB~1.38_\c\x86_64-w64-mingw32\lib" -L"C:\STRAWB~1.38_\c\lib\gcc\x86_64-w64-mingw32\13.1.0"'
    libpth=C:\STRAWB~1.38_\c\lib C:\STRAWB~1.38_\c\x86_64-w64-mingw32\lib C:\STRAWB~1.38_\c\lib\gcc\x86_64-w64-mingw32\13.1.0 C:\STRAWB~1.38_\c\x86_64-w64-mingw32\lib C:\STRAWB~1.38_\c\lib\gcc\x86_64-w64-mingw32\13.1.0
    libs= -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
    perllibs= -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
    libc=
    so=dll
    useshrplib=true
    libperl=libperl538.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_win32.xs
    dlext=xs.dll
    d_dlsymun=undef
    ccdlflags=' '
    cccdlflags=' '
    lddlflags='-shared -s -L"C:\STRAWB~1.38_\perl\lib\CORE" -L"C:\STRAWB~1.38_\c\lib" -L"C:\STRAWB~1.38_\c\x86_64-w64-mingw32\lib" -L"C:\STRAWB~1.38_\c\lib\gcc\x86_64-w64-mingw32\13.1.0"'


Characteristics of this binary (from libperl):
  Compile-time options:
    HAS_LONG_DOUBLE
    HAS_TIMES
    HAVE_INTERP_INTERN
    MULTIPLICITY
    PERLIO_LAYERS
    PERL_COPY_ON_WRITE
    PERL_DONT_CREATE_GVSV
    PERL_HASH_FUNC_SIPHASH13
    PERL_HASH_USE_SBOX32
    PERL_IMPLICIT_SYS
    PERL_MALLOC_WRAP
    PERL_OP_PARENT
    PERL_PRESERVE_IVUV
    PERL_USE_SAFE_PUTENV
    USE_64_BIT_INT
    USE_ITHREADS
    USE_LARGE_FILES
    USE_LOCALE
    USE_LOCALE_COLLATE
    USE_LOCALE_CTYPE
    USE_LOCALE_NUMERIC
    USE_LOCALE_TIME
    USE_PERLIO
    USE_PERL_ATOF
  Built under MSWin32
  Compiled at Jul  6 2023 22:36:11
  @INC:
    C:/Strawberry5.38_64/perl/site/lib
    C:/Strawberry5.38_64/perl/vendor/lib
    C:/Strawberry5.38_64/perl/lib```

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions