LanX has asked for the wisdom of the Perl Monks concerning the following question:

Hi

I want to hack my own Perl shell which works alike on Win and Linux w/o resorting to bash.

But now I'm banging my head against a strange C&P problem:

This is what I get after copying from the Perl-debugger started with perl -dE0 inside a cmd.exe on Win

+ DB<1> say for 1..3 1 2 3 + DB<2>

But that's what I originally see in the console

DB<1> say for 1..3 1 2 3 DB<2>

I was already experimenting for hours to find the reason for the strange indentation of newlines.

Pasting the same lines into emacs and examining the hex-codes show exactly 74 spaces "\x20" in front of the DB<*> prompts.

My guess is that Perl is printing some "newline" codes are emittited that windows doesn't like.

FWIW: settings of the cmd.exe tell me it's running with

  • Codepage cp850
  • The "LineSelection" option is active.
  • TERM is set to dumb, but erasing it has no effect

    C:\>set TERM TERM=dumb C:\>

    Strangely copying from outside perl-applications on the cmd-prompt level doesn't show that problem. ( reply has the same issue)

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

    update
  • Replies are listed 'Best First'.
    Re: (WIN) copy and pasting from Perl-prints inside cmd.exe
    by NetWallah (Canon) on Mar 07, 2020 at 16:05 UTC
      I could not reproduce it on Strawberry perl:
      'Win32 strawberry-perl 5.30.1.1 #1 Fri Nov 22 02:24:29 2019 x64'

      Pastes correctly for me, with no extra spaces.
      It preserves the 2 spaces in front of the "DB" prompt.

                      "From there to here, from here to there, funny things are everywhere." -- Dr. Seuss

        Thanks, I will try to reproduce it on a colleague's box on Monday.

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        Wikisyntax for the Monastery

          What versions of Windows are being used here? You didn't mention, neither did NetWallah.

          In my berrybrew work, I found that there are differences in the functionality of cmd.exe regarding copy/paste on different versions of Windows.

          I may be able to do some testing here if I know what versions of Windows.

    Re: (WIN) copy and pasting from Perl-prints inside cmd.exe
    by NetWallah (Canon) on Mar 09, 2020 at 17:55 UTC
      I have reproduced the issue on:
      perl5 (revision 5 version 24 subversion 0)
      AKA ActivePerl Build 2400 [300558]
      Microsoft Windows [Version 10.0.17134.1246]

      I tried to mess with the debug options "o <option>" - none seem to have any effect on the pasted <DB> line.

                      "From there to here, from here to there, funny things are everywhere." -- Dr. Seuss

        Great, many thanks.

        Now I need to nail down if it's Perl or Win which changed.

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        Wikisyntax for the Monastery

          FYI - on the same system - the same perl run from the powershell command line doe NOT introduce 150 spaces when copied.

          So the extra space behaviour seems to be particular to Activestate perl and the windows 'cmd' prompt.

                          "From there to here, from here to there, funny things are everywhere." -- Dr. Seuss

    Re: (WIN) copy and pasting from Perl-prints inside cmd.exe (rxvt)
    by Anonymous Monk on Mar 07, 2020 at 22:50 UTC

      ??  start "" C:\MinGW\msys\1.0\msys.bat -rxvt

      nevermind :)