in reply to Overriding "-s", "-f" and other -X functions
Hello Doctrin,
I haven’t tried it, but here is an excerpt from the documentation for the core overload pragma, under “Overloadable Operations”:
- File tests
The key '-X' is used to specify a subroutine to handle all the filetest operators (-f, -x, and so on: see -X for the full list); it is not possible to overload any filetest operator individually. To distinguish them, the letter following the '-' is passed as the second argument (that is, in the slot that for binary operators is used to pass the second operand).
Calling an overloaded filetest operator does not affect the stat value associated with the special filehandle _. It still refers to the result of the last stat, lstat or unoverloaded filetest.
This overload was introduced in Perl 5.12.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Overriding "-s", "-f" and other -X functions
by haukex (Archbishop) on Jul 07, 2018 at 08:00 UTC |