Perl: mocking -d -f and friends. How to put them into CORE::GLOBAL

前端 未结 5 1576
遇见更好的自我
遇见更好的自我 2020-12-10 04:08

The CORE documentation has shown me how to merrily mock various built Perl functions. However, I\'m not really sure how to replace \'-d\' &c. with my methods. So this is

5条回答
  •  情深已故
    2020-12-10 04:44

    CORE::GLOBAL doesn't work on things without prototypes. The only way I can think to do it is rewrite the opcode tree... which is not for the faint of heart. You could pull it off with a combination of B::Utils and B::Generate and a lot of experimentation.

    Simplest thing to do would be to use File::Temp to make a temporary directory structure to your liking.

提交回复
热议问题