and the compressed ones withopen(HANDLE, $filename) or die ...
These two different ways of opening a file are in two different sub's...open(HANDLE, "$unzip $unzip_opts $filename |") or die ...
I don't see why you need (or want) two separate subroutines for opening the file -- the only thing different is the string being passed to open().
So, based on what gets returned by your "_detect_type()" method, why not just set a scalar to either $filename or "$unzip $unzip_opts $filename |" and pass that scalar to "open()". No need to keep track of alternate sub references (unless you have something else going on in those two different open subs that you haven't told us about...)
Granted, opening a pipe will return a pid, which you might want, but that can still be accommodated without needing a separate sub for a pipe open vs. a file open.
In reply to Re: Comparing references to sub's
by graff
in thread Comparing references to sub's
by leriksen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |