Marshal format filter? 1.6.8 to 1.8.1

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

I’m kind of curious about that, too, as my current Iowa implementation
relies on Marshal, which means that Iowa servlets have to be running the
same version of Ruby as the code that is sending a request to them.

I tried using YAML to do what Marshal is doing, but the last time I tried
it, under 1.6.8, with an older version of YAML, it was horribly, horribly
slow, so I reluctantly went back to Marshal.

This is a tangent, but is YAML any faster than it used to be?

I have other reasons for not wanting to use Marshal (namely, makes it
rather difficult to have a Perl CGI or a handler written in C make
requests to Iowa servlets), so I may have to roll my own task oriented
communications protocol here, but I don’t want to do that just yet if I
don’t have to.

Thanks,

Kirk Haines

···

On Thu, 22 Jan 2004, Berger, Daniel wrote:

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.

Hi,

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.
···

In message “Marshal format filter? 1.6.8 to 1.8.1” on 04/01/22, “Berger, Daniel” djberge@qwest.com writes: