file io - Perl in memory content writing in raw mode -
i using perl 5.10.0 , trying write content in memory buffer in raw mode. not working. in following code snippet tried compare result between 3 scenarios
my ($s1, $s2); open rawf, '>:raw', \$s1; #<------- opening in memory reference in raw mode print rawf 'hello world in raw mode', "\n"; open fh, '>:raw', 'testfile.bin'; #<------- opening file in raw mode print fh 'hello world in file', "\n"; open norf, '>', \$s2; #<------- opening in memory reference in normal mode print norf 'hello world in normal mode', "\n"; print $s1; #<------ doesnt print print $s2; #<------ prints expected
however, if use perl 5.14.* works. limitation of perl 5.10.1? or should done in other way work?
apparently bug fixed in perl 5.12 timeframe. see perlbug #80764 - though initial report/fix doesn't mention problem, problem comes in discussion on bug , rolled patches.
Comments
Post a Comment