diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-03-24 16:46:02 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-03-24 16:46:02 +0000 |
commit | 8d7403e622043328cfb0578383ba6695cddabd46 (patch) | |
tree | 688db46eecd156075ac07cf968eec971b589500e | |
parent | 7b734803d2ca6996dddda574daf78d9957b470cd (diff) | |
download | perl-8d7403e622043328cfb0578383ba6695cddabd46.tar.gz |
Make readpipe default to $_
p4raw-id: //depot/perl@30747
-rw-r--r-- | op.c | 7 | ||||
-rw-r--r-- | pod/perlfunc.pod | 3 | ||||
-rwxr-xr-x | t/op/exec.t | 6 |
3 files changed, 14 insertions, 2 deletions
@@ -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 c23dbd9af5..ab0213636c 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<readpipe> 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<qx/EXPR/> operator, but you can use it directly. The C<qx/EXPR/> operator is discussed in more detail in L<perlop/"I/O Operators">. +If EXPR is omitted, uses C<$_>. =item recv SOCKET,SCALAR,LENGTH,FLAGS X<recv> diff --git a/t/op/exec.t b/t/op/exec.t index c13849199a..ed5b2b6116 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(); |