From: Tom Sawyer Date: 2002-12-24T09:40:10+09:00 Subject: Re: go ahead, marshal ruby objects via html yes i know, the name attribute of marshal_to_html isn't used. its meant to offer an alternative to _marshal, but havne't implemented yet. On Monday 23 December 2002 05:31 pm, Tom Sawyer wrote: > doing a lot of eruby/cgi scripting and discovered a neat way to pass entire > ruby objects between cgi forms. have a look. Note: this is pulled from the > library i've created called CGIze for doing a number of cgi related things. > @@cgi holds an instance of CGI.new. > > def CGIze.marshal_to_html(iobj, name='') > data = CGI.escape(Marshal.dump(iobj)) > print('') > end > > def CGIze.marshal_from_html > return Marshal.load(CGI.unescape(@@cgi['_marshal'][0])) > end > > this saves me a bunch of headache over using lots of hidden variables to > pass all of an object's data and it seemlessly deals with all types of > instance variables whether they be arrays, hashes, or whatever. > > just thought somebody might be interested. > > -transami