Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: why allow grep with no list? (Re^3: compare always true in grep)

by Loops (Curate)
on Oct 25, 2014 at 05:00 UTC ( [id://1104949]=note: print w/replies, xml ) Need Help??


in reply to Re: why allow grep with no list? (Re^3: compare always true in grep)
in thread compare always true in grep

Had some spare cycles, so gave it a go... didn't take long to come back with the commit quoted below. It's over two years ago now (first appeared in v5.17.2), and from the commit message looks like maybe a path where the check doesn't happen was overlooked?:

commit c087f08cbf44e0e4794563768e3adf95e484be98
Author: Father Chrysostomos <sprout@cpan.org>
Date:   Sat Jul 14 12:28:15 2012

    op.c: ck_grep does not need to check num of args

    It calls ck_fun first, which does the same check, so it is
    unnecessary.

diff --git a/op.c b/op.c
index acea933..b5a78d5 100644
--- a/op.c
+++ b/op.c
@@ -8622,8 +8622,6 @@ Perl_ck_grep(pTHX_ OP *o)
     }

     kid = cLISTOPo->op_first->op_sibling;
-    if (!kid || !kid->op_sibling)
-       return too_few_arguments_pv(o,OP_DESC(o), 0);
     for (kid = kid->op_sibling; kid; kid = kid->op_sibling)
        op_lvalue(kid, OP_GREPSTART);

  • Comment on Re^2: why allow grep with no list? (Re^3: compare always true in grep)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1104949]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-20 02:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found