Re: POE::Component::Server::TCP bug fixes, possibly incompatible

Rocco Caputo <[email protected]>
Newsgroups gmane.comp.lang.perl.poe
Message-ID <[email protected]>
On Jul 14, 2009, at 02:16, Michael Fowler wrote:
>
>    http://rt.cpan.org/Ticket/Display.html?id=47855
>
> 47855 requires a bit of discussion.
>
> The problem is that the ClientConnected callback does not actually
> receive a socket in ARG0.  ARG0 has been spliced off in the
> POE::Wheel::ReadWrite constructor, so ARG0 is actually the ClientArgs
> parameter.  This change was implemented nearly 4 years ago (to fix a
> leaking socket problem), so anything that actually uses ARG0 will  
> break
> if the code is changed to match the documentation.
>
> How should the code be changed?  Should it be made conservatively, so
> that any code relying on ARG0 being ClientArgs continues to work?
> Should it be fixed to match the documentation?

The documentation is wrong.  I misread the code and thought that  
ClientConnected was part of the POE::Wheel::SocketFactory SuccessEvent  
handler.  It's not.  It's really part of the client-handling session's  
_start handler, which has different semantics.  For starters, $_[ARG0]  
isn't guaranteed to contain anything in particular.

> One advantage of out and out breaking old code  is that ClientArgs  
> could
> actually be flattened into ARG1..$#_.

I think you're almost right.  The correct behavior would be for  
ClientArgs to align with @_[ARG0..$#_].  This still breaks current  
code, but it's cleaner.

-- 
Rocco Caputo - [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.