On Tue, 21 Feb 2017 20:47:35 +0100, Matt S Trout <mst@shadowcat.co.uk> wrote: > Dealing with the fallout of removing '.' from @INC has been an interesting > exercise, but in the case of require()d files, I think overall a worthy one. > > I'm rather less convinced about do(). > > In fact, I didn't until very recently realise that do() searched @INC, my > mental model of it had always been 'run this path and return the result', > and every piece of code I've seen in the wild that used it appeared to be > based on the same expectation. It's not only your mental model, it is what is documented in perldoc, with the "searches @INC" part being worded as an addendum to the base functionality: http://perldoc.perl.org/functions/do.html Uses the value of EXPR as a filename and executes the contents of the file as a Perl script. do 'stat.pl'; is largely like eval `cat stat.pl`; So in my opinion `do "thing"` should be modified to match perldoc for backwards compatibility, i.e. look in "." first, then @INC if that fails. The point has been raised by haarg and leont that that might not be entirely straight-forward due to shared code between use/require, but i think in this case backwards compatibiliy should trump, even if the core code looks a little more ugly as a result. And well, if you don't, please remember to fix up perldoc. -- With regards, Christian WaldeThread Previous | Thread Next