From 3855d70e7f99bf3ce9c10e71f794d7afd5856f09 Mon Sep 17 00:00:00 2001 From: James E Keenan Date: Thu, 3 Jun 2021 12:22:16 +0000 Subject: [PATCH 1/4] Replace 'slave' with 'client' This commit moves us a step forward on eliminating 'master/slave' terminology. Its scope is limited to those files within the Perl 5 core distribution which are not CPAN-upstream. Within that scope, we leave untouched the use of the term 'slave' in epigraphs and other literary quotations and its use in data coming from outside sources (e.g., Unicode code points). Increment $VERSION in lib/perl5db.pl. --- lib/perl5db.pl | 64 +++++++++++++++++++++++------------------------ pod/perldebug.pod | 2 +- pod/perlipc.pod | 2 +- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/lib/perl5db.pl b/lib/perl5db.pl index 3ab6e577a2f6..36ce1119ab14 100644 --- a/lib/perl5db.pl +++ b/lib/perl5db.pl @@ -393,7 +393,7 @@ =head4 C<$trace> =back -=head4 C<$slave_editor> +=head4 C<$client_editor> 1 if C was directed to a pipe; 0 otherwise. @@ -531,7 +531,7 @@ BEGIN use vars qw($VERSION $header); # bump to X.XX in blead, only use X.XX_XX in maint -$VERSION = '1.60'; +$VERSION = '1.61'; $header = "perl5db.pl version $VERSION"; @@ -1221,9 +1221,9 @@ =head2 SETTING UP THE DEBUGGER GREETING use vars qw($pidprompt); $pidprompt = ''; -# Sets up $emacs as a synonym for $slave_editor. -our ($slave_editor); -*emacs = $slave_editor if $slave_editor; # May be used in afterinit()... +# Sets up $emacs as a synonym for $client_editor. +our ($client_editor); +*emacs = $client_editor if $client_editor; # May be used in afterinit()... =head2 READING THE RC FILE @@ -1504,7 +1504,7 @@ sub _autoflush { =pod If there is a TTY, we have to determine who it belongs to before we can -proceed. If this is a slave editor or graphical debugger (denoted by +proceed. If this is a client editor or graphical debugger (denoted by the first command-line switch being '-emacs'), we shift this off and set C<$rl> to 0 (XXX ostensibly to do straight reads). @@ -1512,9 +1512,9 @@ sub _autoflush { else { - # Is Perl being run from a slave editor or graphical debugger? - # If so, don't use readline, and set $slave_editor = 1. - if ($slave_editor = ( @main::ARGV && ( $main::ARGV[0] eq '-emacs' ) )) { + # Is Perl being run from a client editor or graphical debugger? + # If so, don't use readline, and set $client_editor = 1. + if ($client_editor = ( @main::ARGV && ( $main::ARGV[0] eq '-emacs' ) )) { $rl = 0; shift(@main::ARGV); } @@ -1584,12 +1584,12 @@ sub _autoflush { =back Several other systems don't use a specific console. We C -for those (Windows using a slave editor/graphical debugger, NetWare, OS/2 -with a slave editor). +for those (Windows using a client editor/graphical debugger, NetWare, OS/2 +with a client editor). =cut - if ( ( $^O eq 'MSWin32' ) and ( $slave_editor or defined $ENV{EMACS} ) ) { + if ( ( $^O eq 'MSWin32' ) and ( $client_editor or defined $ENV{EMACS} ) ) { # /dev/tty is binary. use stdin for textmode $console = undef; @@ -1603,7 +1603,7 @@ sub _autoflush { # In OS/2, we need to use STDIN to get textmode too, even though # it pretty much looks like Unix otherwise. - if ( defined $ENV{OS2_SHELL} and ( $slave_editor or $ENV{WINDOWID} ) ) + if ( defined $ENV{OS2_SHELL} and ( $client_editor or $ENV{WINDOWID} ) ) { # In OS/2 $console = undef; } @@ -1698,7 +1698,7 @@ =head2 SOCKET HANDLING _autoflush($OUT); # Line info goes to debugger output unless pointed elsewhere. - # Pointing elsewhere makes it possible for slave editors to + # Pointing elsewhere makes it possible for client editors to # keep track of file and position. We have both a filehandle # and a I/O description to keep track of. $LINEINFO = $OUT unless defined $LINEINFO; @@ -1725,7 +1725,7 @@ =head2 SOCKET HANDLING print $OUT "\nLoading DB routines from $header\n"; print $OUT ( "Editor support ", - $slave_editor ? "enabled" : "available", ".\n" + $client_editor ? "enabled" : "available", ".\n" ); print $OUT "\nEnter h or 'h h' for help, or '$doccmd perldebug' for more help.\n\n"; @@ -2182,8 +2182,8 @@ sub _DB__handle_forward_slash_command { # expression would be better, so the user could # do case-sensitive matching if desired. if ($dbline[$start] =~ m/$pat/i) { - if ($slave_editor) { - # Handle proper escaping in the slave. + if ($client_editor) { + # Handle proper escaping in the client. print {$OUT} "\032\032$filename:$start:0\n"; } else { @@ -2260,8 +2260,8 @@ sub _DB__handle_question_mark_command { # Match? if ($dbline[$start] =~ m/$pat/i) { - if ($slave_editor) { - # Yep, follow slave editor requirements. + if ($client_editor) { + # Yep, follow client editor requirements. print $OUT "\032\032$filename:$start:0\n"; } else { @@ -2641,7 +2641,7 @@ sub _cmd_l_handle_subname { # If we're not in that file, switch over to it. if ( $file ne $filename ) { - if (! $slave_editor) { + if (! $client_editor) { print {$OUT} "Switching to file '$file'.\n"; } @@ -2721,8 +2721,8 @@ sub _cmd_l_range { my ($end, $i) = _cmd_l_calc_initial_end_and_i($spec, $start_match, $end_match); - # If we're running under a slave editor, force it to show the lines. - if ($slave_editor) { + # If we're running under a client editor, force it to show the lines. + if ($client_editor) { print {$OUT} "\032\032$filename:$i:0\n"; $i = $end; } @@ -2768,7 +2768,7 @@ sub _cmd_l_range { if ($dbline[ $i - 1 ] !~ /\n\z/) { print {$OUT} "\n"; } - } ## end else [ if ($slave_editor) + } ## end else [ if ($client_editor) # Save the point we last listed to in case another relative 'l' # command is desired. Don't let it run off the end. @@ -3630,7 +3630,7 @@ sub _DB__grab_control my $self = shift; # Yes, grab control. - if ($slave_editor) { + if ($client_editor) { # Tell the editor to update its position. $self->position("\032\032${DB::filename}:$line:0\n"); @@ -3724,7 +3724,7 @@ sub _DB__grab_control $self->append_to_position($incr_pos); $self->_my_print_lineinfo($i, $incr_pos); } ## end for ($i = $line + 1 ; $i... - } ## end else [ if ($slave_editor) + } ## end else [ if ($client_editor) return; } @@ -6185,7 +6185,7 @@ =head2 C - show where we are now print_lineinfo prints whatever it is that it is handed; it prints it to the C<$LINEINFO> filehandle instead of just printing it to STDOUT. This allows -us to feed line information to a slave editor without messing up the +us to feed line information to a client editor without messing up the debugger output. =cut @@ -6459,10 +6459,10 @@ sub print_trace { local $\ = ''; my $fh = shift; - # If this is going to a slave editor, but we're not the primary + # If this is going to a client editor, but we're not the primary # debugger, reset it first. resetterm(1) - if $fh eq $LINEINFO # slave editor + if $fh eq $LINEINFO # client editor and $LINEINFO eq $OUT # normal output and $term_pid != $$; # not the primary @@ -7983,8 +7983,8 @@ sub LineInfo { # '>' onto the front. my $stream = ( $lineinfo =~ /^(\+?\>|\|)/ ) ? $lineinfo : ">$lineinfo"; - # If this is a pipe, the stream points to a slave editor. - $slave_editor = ( $stream =~ /^\|/ ); + # If this is a pipe, the stream points to a client editor. + $client_editor = ( $stream =~ /^\|/ ); my $new_lineinfo_fh; # Open it up and unbuffer it. @@ -9906,10 +9906,10 @@ sub restart { # And run Perl again. Add the "-d" flag, all the # flags we built up, the script (whether a one-liner - # or a file), add on the -emacs flag for a slave editor, + # or a file), add on the -emacs flag for a client editor, # and then the old arguments. - return ($^X, '-d', @flags, @script, ($slave_editor ? '-emacs' : ()), @ARGS); + return ($^X, '-d', @flags, @script, ($client_editor ? '-emacs' : ()), @ARGS); }; # end restart diff --git a/pod/perldebug.pod b/pod/perldebug.pod index 1274e9d03eb8..2c58ca3e24cc 100644 --- a/pod/perldebug.pod +++ b/pod/perldebug.pod @@ -740,7 +740,7 @@ X File or pipe to print line number info to. If it is a pipe (say, C<|visual_perl_db>), then a short message is used. This is the -mechanism used to interact with a slave editor or visual debugger, +mechanism used to interact with a client editor or visual debugger, such as the special C or C hooks, or the C graphical debugger. diff --git a/pod/perlipc.pod b/pod/perlipc.pod index b5f7a2961941..1a6699a5b566 100644 --- a/pod/perlipc.pod +++ b/pod/perlipc.pod @@ -1008,7 +1008,7 @@ or firewall machine), fill this in with your real address instead. } And here's a multitasking version. It's multitasked in that -like most typical servers, it spawns (fork()s) a slave server to +like most typical servers, it spawns (fork()s) a client server to handle the client request so that the master server can quickly go back to service a new client. From b59587ee7230c57379e780db81da351e803fd707 Mon Sep 17 00:00:00 2001 From: James E Keenan Date: Mon, 7 Jun 2021 12:00:52 +0000 Subject: [PATCH 2/4] One revision per rjbs feedback --- pod/perlipc.pod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pod/perlipc.pod b/pod/perlipc.pod index 1a6699a5b566..5d258a0bce1e 100644 --- a/pod/perlipc.pod +++ b/pod/perlipc.pod @@ -1008,7 +1008,7 @@ or firewall machine), fill this in with your real address instead. } And here's a multitasking version. It's multitasked in that -like most typical servers, it spawns (fork()s) a client server to +like most typical servers, it spawns (fork()s) a child server to handle the client request so that the master server can quickly go back to service a new client. From 14cfc78481a04a5bbcbb8af9aea2b477db4755f7 Mon Sep 17 00:00:00 2001 From: James E Keenan Date: Mon, 7 Jun 2021 22:01:22 +0000 Subject: [PATCH 3/4] tie a variable; untested --- lib/perl5db.pl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/perl5db.pl b/lib/perl5db.pl index 36ce1119ab14..4e155656eb76 100644 --- a/lib/perl5db.pl +++ b/lib/perl5db.pl @@ -1225,6 +1225,16 @@ =head2 SETTING UP THE DEBUGGER GREETING our ($client_editor); *emacs = $client_editor if $client_editor; # May be used in afterinit()... +package RenameVariable; +require Tie::Scalar; +our @ISA = qw(Tie::Scalar); +our $message = '$slave_editor deprecated; use $client_editor instead'; +sub FETCH { warn $message; } +sub STORE { die $message; } + + +package DB; + =head2 READING THE RC FILE The debugger will read a file of initialization options if supplied. If From e96d81b0350e58b9d380b95f5b1104c786f6b370 Mon Sep 17 00:00:00 2001 From: James E Keenan Date: Mon, 7 Jun 2021 22:16:26 +0000 Subject: [PATCH 4/4] Have FETCH return $client_editor Per suggestion from Leon Timmermans. --- lib/perl5db.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/perl5db.pl b/lib/perl5db.pl index 4e155656eb76..70ea08e4c950 100644 --- a/lib/perl5db.pl +++ b/lib/perl5db.pl @@ -1229,7 +1229,7 @@ package RenameVariable; require Tie::Scalar; our @ISA = qw(Tie::Scalar); our $message = '$slave_editor deprecated; use $client_editor instead'; -sub FETCH { warn $message; } +sub FETCH { warn $message; return $client_editor; } sub STORE { die $message; }