Currently, overriding filetest operator can be done via overload, but this has limited use because you cannot override the common case of things like -x "filename". Would it be a good idea for the filetest operators to lookup stat() in the current package first and thus make them overridable via overriding stat()? Much like the backtick operator is overridable by overriding readpipe() (which I employ in IPC::System::Options).
One use-case I'm thinking of for overriding the filetest operators is testing. In test script I sometimes check for the existence of programs like /bin/bash and skip tests accordingly. I want to simulate the absence of /bin/bash even though my system has the program.
In reply to Overriding filetest operators via overriding stat()? by perlancar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |