Problems? Is your data what you think it is? | |
PerlMonks |
Re^4: File::Temp: 2 interfaces get different results with Digest::MD5 and File::Compareby jkeenan1 (Deacon) |
on Aug 29, 2021 at 21:47 UTC ( [id://11136193]=note: print w/replies, xml ) | Need Help?? |
Corion,
Based on your suggestion, I developed the workaround below. The trick seems to have three parts to it: 1. binmode $FH, ':raw': binmode the tempfile(handle) before writing to it. (I suspect that on Unix, we can get away without the ':raw', but whatever.) 2. close $FH: close the tempfile(handle) after writing to it and before calling hexdigest on it. 3. Ignore File::Compare::compare() for now. (I don't need for my real-world problem, anyway.)
Why this works I do not know. I think this is, at the very least, a deficiency in the File::Temp documentation and will file a bug report on it. Thank you for your assistance.
Jim Keenan
In Section
Seekers of Perl Wisdom
|
|