Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Digest::MD5 addfile() w/ tied filehandleby jdv (Sexton) |
on Sep 01, 2015 at 21:18 UTC ( [id://1140719]=note: print w/replies, xml ) | Need Help?? |
Following the suggestion of BrowserUk, I tried to write a bare-minimum example of this behavior. The code is below. The TieTest class is basically meant to remember an internal filehandle and then pass that along with the rest of the arguments through to the core Perl functions. There are two interesting/questionable observations. First, with line 19 commented out as it is, Digest::MD5 croaks that it was not passed a filehandle. Maybe I'm doing something wrong here? The only way I have found to get around this is to open the filehandle on something before tie'ing it. If I do that (by uncommenting line 19 and feeding the script two different filenames) the pure-Perl implementation acts on the last file opened, while the XS implementation is clearly reading from the first file opened on line 19 and not talking to the tied class (I added a debugging statement to the READ sub just to be sure). This does seem like a bug to me (although saying that out loud pretty much guarantees that I'll find an error in my own code within the next five minutes). Does anyone have any further thoughts on this? Otherwise I'll submit it as a possible bug as suggested. Here is the test case
In Section
Seekers of Perl Wisdom
|
|