in reply to Re^2: Is there any way to override "file test operator"?
in thread Is there any way to override "file test operator"?
I read back through this thread. Now that I see it again, the question appears to be "how can I make new file test operator?".
I don't know how to do that.
I don't know how to do that.
Overriding an existing file operator (like: -e $filename) is very bad idea. I stick to that opinion. The issue is when I see a line like that in some huge amount of code, I expect -e to do what it normally does without having to read any previous code that redefined that operation. And BTW, I don't know how to redefine -e either.
In this case, I would make a subroutine that did the desired test and use that. In terms of execution efficiency, I see no difference. In terms of source code, there would be a huge increase in clarity.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Is there any way to override "file test operator"?
by QM (Parson) on Mar 21, 2018 at 11:48 UTC | |
Re^4: Is there any way to override "file test operator"?
by Anonymous Monk on Jul 07, 2018 at 19:57 UTC |
In Section
Seekers of Perl Wisdom