Marshal format filter? 1.6.8 to 1.8.1

B

Berger, Daniel

Hi all,

I'm in a situation where I may want to have a 1.8.1 client communicate
with a 1.6.8 server, where the server is sending back marshal'd data.
Is there a way to "filter" a 1.6.8 format into a 1.8.1 format, and
vice-versa?

Because the Marshal format can change even between minor releases, I
think having a filter of some sort like this would be a good thing to
have around in general.

Or, is this impractical?

Regards,

Dan
 
Y

Yukihiro Matsumoto

Hi,

In message "Marshal format filter? 1.6.8 to 1.8.1"

|I'm in a situation where I may want to have a 1.8.1 client communicate
|with a 1.6.8 server, where the server is sending back marshal'd data.
|Is there a way to "filter" a 1.6.8 format into a 1.8.1 format, and
|vice-versa?

Simplest filter (should run on 1.8.1):

Marshal.dump(Marshal.load(STDIN), STDOUT)

Binary hack:

open(file, "r+"){|f|
f.rewind
f.putc Marshal::MAJOR_VERSION
f.putc Marshal::MINOR_VERSION
}

I recommend you not to convert downward.

matz.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,141
Messages
2,570,817
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top