From: Francis Hwang Date: 2002-05-23T20:50:46+09:00 Subject: Re: Marshal error: "singleton can't be dumped" Patrick May wrote: >Francis Hwang wrote in message >news:... >> Kent Dahl wrote: >> >Then perhaps it is refering to singleton methods? >> >> Ah, never mind, I dug into the object I was trying to Marshal and >> realized that it held an instance of CGI that Ruby didn't want to >> Marshal. I fixed that, and things seem to work fine now. > >ahh... b/c cgi params can have singleton methods. > >well, that makes my :values plan sound like a bad idea... :-) It's not necessarily that big of a deal. You can take in a singleton class in any given method, you just can't hold on to it. So in my class' initialize method, I just sucked out all the data I wanted out of the cgi instance, and put it into a hash. Pretty minor, actually. I also had a class that held onto an instance of Mysql, but you don't actually need to preserve that actual instance, you just need to know to have a valid Mysql connection ... So I had to hack the _load and _dump code to deal with that member variable specially, but the whole thing only took me a few minutes. Francis --