3 ms·
It can be, of course. There is more than one way to do it, because there's more than one situation in which one wants to use it. Most of my larger projects use
by phaylon 16y ago
It can be, of course. There is more than one way to do it, because there's more than one situation in which one wants to use it. Most of my larger projects use Path::Class, but none of my scripts in ~phaylon/bin do, since I want to use some of them even if I don't have a perl setup yet.
Another reason might be that you're writing a CPAN module and don't do much with files. If you just use it to write a debug log when an environment variable is set, you might not want to include another dependency.
What your code demonstrates very good in my opinion is the fact that lexical filehandles are just more interoperable. You can pass them around transparently like any other reference, use modules that pass them around, and so on.