http://qs321.pair.com?node_id=624302


in reply to Re^2: SOAP Modules (OO or not?)
in thread SOAP Modules (OO or not?)

When SOAP dispatches to my module and method, the first thing passed to that method is the name of module, which leads me to think that it is being called in an OO context, and so i should bless it once i get inside.

When a method receives a class name, not a blessed reference, it is being called as a class method. If you want to use OO features like inheritance, you can continue to call the other subs as class methods. You don't need to though.

sub foo { my $class = shift; $class->bar(); # call bar() as a class method }

I'm not talking about treating it like an object when I pass it back through SOAP, although that would work fine too, so where's the harm?

That actually wouldn't work at all unless you did a lot of crazy workarounds. The XML serialization that SOAP uses is intentionally language-agnostic, so it has no way to represent the concept of something being blessed into a class.