From: Joel VanderWerf Date: 2013-07-02T01:40:55+09:00 Subject: Re: including FileUtils::Verbose crashes Marshal.dump On 07/01/2013 09:22 AM, Bryan Lockwood wrote: ... > My problem was that I read about fileutils in the pickaxe book (for 1.9 and 2.0), and the example included FileUtils::Verbose, > and I figured that would be fine for starters, as I could then see what it was doing. That example[1] seems to have been written with brevity in mind. It's ok in a 10 line script to include modules globally. In general, one must be careful, for reasons like the one you found. The internal state managed by those modules can interact badly with the internal state of other classes. It's better, though more verbose, to call methods on the module: FileUtils.cp(....) An exception would be if you were designing a class as a command language, like rake. But in that case, you would only include FileUtils into that class, not globally. [1] Here's the Pickaxe example: require 'fileutils' include FileUtils::Verbose cd("/tmp") do cp("/etc/passwd", "tmp_passwd") chmod(0666, "tmp_passwd") cp_r("/usr/include/net/", "headers") rm("tmp_passwd") # Tidy up rm_rf("headers") end