A strange one, so I'd like to solicit some opinions :-).
Client::TCP starts up with a 'server' wheel stashed away in the heap as a POE::Wheel::SocketFactory while it's waiting for the connection to occur. Once the connection is successful, it changes it's {server} in the heap to be a POE::Wheel::ReadWrite. This is commented as 'Ok to overwrite like this as of 0.13'.
The issue is that these two wheels have very different methods. The documentation says that if you want to send data, you should invoke $heap->{server}->put(). Which works just fine when {server} is the readwrite wheel. However, 'put' is not a method understood by a socketfactory.
Why might you be trying to send data when not connected? Well, the issue is that the connection might die/be reset by the app in which case the state engine will probably transition to 'reconnect' which will switch the {server} back into a SocketFactory. There might still be events waiting to fire (e.g. delays) which will with a bit of bad luck end up firing while {server} is a SocketFactory and not the ReadWrite wheel.
Now, I could change my code to check the isa() of the server wheel in all the callbacks, but it seems like a bit of a hack that I have to code defensively around the wheel changing underneath me.
Is there a better way of doing this?
