From: Rafael Garcia-Suarez Date: Sat, 24 Mar 2007 16:46:02 +0000 (+0000) Subject: Make readpipe default to $_ X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8d7403e622043328cfb0578383ba6695cddabd46;p=p5sagit%2Fp5-mst-13.2.git Make readpipe default to $_ p4raw-id: //depot/perl@30747 --- diff --git a/op.c b/op.c index c10bf95..48437cf 100644 --- a/op.c +++ b/op.c @@ -6908,8 +6908,13 @@ Perl_ck_open(pTHX_ OP *o) o->op_private |= OPpOPEN_OUT_CRLF; } } - if (o->op_type == OP_BACKTICK) + if (o->op_type == OP_BACKTICK) { + if (!(o->op_flags & OPf_KIDS)) { + op_free(o); + return newUNOP(OP_BACKTICK, 0, newDEFSVOP()); + } return o; + } { /* In case of three-arg dup open remove strictness * from the last arg if it is a bareword. */ diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index c23dbd9..ab02136 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -4305,6 +4305,8 @@ error, returns the undefined value and sets C<$!> (errno). If EXPR is omitted, uses C<$_>. =item readpipe EXPR + +=item readpipe X EXPR is executed as a system command. @@ -4315,6 +4317,7 @@ multi-line) string. In list context, returns a list of lines This is the internal function implementing the C operator, but you can use it directly. The C operator is discussed in more detail in L. +If EXPR is omitted, uses C<$_>. =item recv SOCKET,SCALAR,LENGTH,FLAGS X diff --git a/t/op/exec.t b/t/op/exec.t index c138491..ed5b2b6 100755 --- a/t/op/exec.t +++ b/t/op/exec.t @@ -19,7 +19,7 @@ my $Is_Win32 = $^O eq 'MSWin32'; skip_all("Tests mostly usesless on MacOS") if $^O eq 'MacOS'; -plan(tests => 21); +plan(tests => 22); my $Perl = which_perl(); @@ -106,6 +106,10 @@ is( <<`END`, "ok\n", '<<`HEREDOC`' ); $Perl -le "print 'ok'" END +{ + my $_ = qq($Perl -le "print 'ok'"); + is( readpipe, "ok\n", 'readpipe default argument' ); +} TODO: { my $tnum = curr_test();