Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

rcaputo (9040)

  (email not shown publicly)

Journal of rcaputo (9040)

Friday April 16, 2010
01:04 AM

Reflex Progress

[ #40313 ]

I've been making good progress on Reflex lately. I have to: I've applied to talk about it at YAPC::NA, so I need something to talk about! The code has been moving too fast for CPAN right now, but you can follow along at Reflex's repository on github. Here's a summary of the latest changes:

I've added support for as many callback mechanisms as I could think of, including one I'm not sure existed before. Callback consumers (the things being called back into) decide the kinds of callbacks they prefer. Objects doing the calling use a single, consistent method: emit(). Reflex handles the rest. The callback types supported so far:

There's even an example that runs with every supported callback type at once. Just because it can!

I've also implemented a few classes that support TCP (and maybe UNIX) clients and servers.

Reflex::Stream is a base class for stream I/O. It extends Reflex::Handle, adding sysread(), syswrite() and buffering. Example usage.

Reflex::Listener is a base class for connection-based servers. Give it an IO::Socket, and it will listen() for and accept() client connections. It also extends Reflex::Handle. See TcpEchoServer in this example.

Reflex::Connector is the other side of the connection-based client/server dialog. It will perform a non-blocking connect() on the IO::Socket you provide. Eventually it'll return that socket in its connected state, or notify you of failure. Reflex::Connector also extends Reflex::Handle. Reflex::Client (below) uses it.

Reflex::Client extends Reflex::Connector and integrates Reflex::Stream for a basic but usable non-blocking client class. Here's a small subclass of Reflex::Client.

And Reflex::Collection is a small object manager. The TcpEchoServer uses it to automatically clean up client objects when they disconnect. This is another common and tedious task that Reflex automates.

Still to do: Document and release all this new goodness, then (presuming it's accepted) write my talk! I hope to see you at YAPC::NA either way.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.