From: alexg@... (Alex Gutteridge) Date: 2004-02-13T02:34:57+09:00 Subject: Marshal.dump - anonymous module Hi, I'm new to Ruby and am having difficulty getting a deep_copy method working. I think I'm just doing something stupid with namespaces, but I'm not sure eactly what. Here's what I've got: module Bio module PDBUtils [snip!] def deep_copy puts "Trying to copy #{self.class}" Marshal.load(Marshal.dump(self)) end end class PDB include PDBUtils [snip!] end end I get a new PDB object fine: structure = Bio::PDB.new() but when I try and use deep_copy I get an error: structure2 = structure.deep_copy Trying to copy Bio::PDB in 'dump': can't dump anonymous module # (TypeError) Googling for this error reveals that Marshal.dump was fixed in 1.8 to not allow dumping of anonymous modules. Unfortunately I'm not sure I understand why it's saying I'm giving it an anonymous module. Doesn't the 'Trying to copy Bio::PDB' output mean that I'm giving it a Bio::PDB object to dump? If somone could explain exactly what an anonymous module is, and why I've got one here I'd really appreciate it. Thanks for your time. Alex Gutteridge alexg@ebi.ac.uk