This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
end of file (^D on POSIX-likes) now behaves like q as documented
authorTony Cook <tony@develop-help.com>
Wed, 21 Sep 2022 23:41:36 +0000 (09:41 +1000)
committerTony Cook <tony@develop-help.com>
Mon, 17 Oct 2022 00:12:42 +0000 (11:12 +1100)
commite2d2ca12ad6517579d1271bdce0c7e6c0ea88ec9
tree87b475834234b3719e160ac186d481277d8392a4
parent4e362c65163fdc38ae2e9739a37d12aed3de18f0
end of file (^D on POSIX-likes) now behaves like q as documented

This was originally reported againt 5.36.0 where ^D would act
more like 'n' than 'q':

$ ~/perl/v5.36.0-clang14/bin/perl -lde 'print 1; print 2; print 3;'

Loading DB routines from perl5db.pl version 1.73
Editor support available.

Enter h or 'h h' for help, or 'man perldebug' for more help.

main::(-e:1):   print 1; print 2; print 3;
  DB<1> 1
main::(-e:1):   print 1; print 2; print 3;
  DB<1> 2
main::(-e:1):   print 1; print 2; print 3;
  DB<1> 3

(^D at each prompt)

Post 80c1f1e4 this behaved a little differently, since reading ^D
from the stream now sets the eof() flag readline() would return
immediately after each attempt, instead of reading a command.

This produced the same output as above, but only required a single ^D.

But neither of these is correct, both 'q' and ^D are documented to
exit the debugger, and 'q' does that, this changes eof to also
exit the debugger.

Unfortunately the perl5db test infrastructure doesn't support
testing this, and due to the way the debugger interacts with the
terminal, I don't think this is easily tested in core.  I think
a module like Expect or IPC::Run that can interact with a terminal
would be needed.
lib/perl5db.pl