Re: Trouble with Marshal

From: Gavin K.

p s2 = Marshal.load( IO.read( ‘desc.marshal’ ) )

#=> foo.rb:13:in `load’: marshal data too short (ArgumentError)

Bah, my stupid fault. It was binary mode at stake, but on reading, not
writing. Mauricio Fernández kindly pointed out my error. Changing the
above to…
File.open( ‘desc.marshal’, ‘rb’ ){ |f| @s2 = Marshal.load( f.read ) }
…fixed my problem.

Thanks for the help, sorry for the noise.