David Nicol wrote:
unless the plugin wrapper somehow clobbers everything in the name space
before loading its methods, or you are clobbering a pre-existing method (which will create a warning) there's no reason not to write methods for one package in a different one (AIUI, all the "package" pragma does is change the default
name space, and nothing else) so the above could be equivalently written as

I wasn't actually too worried about whether the namespace trick would work as to whether it would have unintended (i.e. action at a distance) effects on the plugin itself. The wrapper code creates a namespace when loading the plugin and I was more concerned about whether that would get interfered with by games inside the plugin (I don't think it will, but I wanted to be sure before suggesting it).

That being said, I'm not happy with this procedure in the general case, mostly because of what Peter suggested about different plugins conflicting. I think it might be better to have a register_method sub will takes a method name and coderef and checks to see whether that method already exists (and warns if it does) before replacing the appropriate package glob. This is a much more flexible practice and allows for carefully control munging of the OO interface (instead of just random violence).

I'd rather provide a screen door that you can use to get inside the object, rather than expecting you to just walk right in... ;-)

John


--
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4501 Forbes Boulevard
Suite H
Lanham, MD  20706
301-459-3366 x.5010
fax 301-429-5748

Reply via email to