Ricardo Signes wrote: > Right now, the situation is already lousy: > > ~$ perl -Mwarnings -e 'sub z { return 0 } do z()' > Use of "do" to call subroutines is deprecated at -e line 1. > > ~$ perl -Mwarnings -e 'sub x { return 0 } do x()' > > My assumption has always been that the 'x' operator is interfering. I have just had a look at the code. 'do' followed by a keyword is always do-file. x is special-cased to allow x() function calls, unlike other infix ops. You will find that BEGIN, END, etc. act the same way. $ perl5.18.1 -we 'do BEGIN()' Undefined subroutine &main::BEGIN called at -e line 1. The same with do CORE(), until I changed it without realising in com- mit a96df64385. (I am proving your point for you. :-) > > Anyway, I think we're better off simply eliminating the special case of `do > SUB(LIST)`, meaning it would fall back to EXPR. On the other hand, I think > this is where the question of backcompat will come in. > > If there's code with `do foo($x)` out in the wild, and it becomes equivalent to > `do(do { foo($X) })`, something stupid is going to happen somewhere. I imagine > we may be doing the world a favor by inserting a period of fatality. Which is what the patch does, though mostly by accident I think. I could follow it up with a clearer 'do SUB has been removed' message after the patch is applied. Should we make an exception for do CORE() and restore the do-file functionality I inadvertently changed?Thread Previous