Subject: | Closing File Handles |
Great module, but there's a "feature" in there that closes file handles when you may not want them closed. For instance, I am using this to get info from an MP3 that was uploaded under CGI, however, I can't save it once it's uploaded because get_mp3tags and get_mp3info will close the file handle before I can save it. Without going into a lot of detail, I really can't save the file until after I've gotten the information from it. I'll propose a fix that leaves the file handles open, but it doesn't rewind the file to the beginning which it probably should. You may have a better way to implement this too, and I'd like to hear what (if any) fix you implement so I can modify my code to match.
Thanks much!
--rob
Proposed that the get_mp3xxx subs be modified as such:
my $no_close; # Flag for close/no close
if (ref $file) { # filehandle passed
$fh = $file;
$no_close = 1; # Set no close if we were passed a file handle
...
_close($file, $fh) unless $no_close; #close only if we were not passed a file hanlde