A question came up at work the other day, if you could override the Perl open() function. There’s many possible uses for this, but work’s was simple: we wanted a log of all files accessed during a program run. The program is large, complex, and uses many modules. An override of open() would let us record the file and open mode, then call CORE::open.
We couldn’t do it. After a second look, I still can’t do it. Not for all cases, anyway. (more…)