flachschippe has asked for the wisdom of the Perl Monks concerning the following question:

Does anyone know of a package providing Unix System V-style stream modules? I seek just the ability to plug stream modules together and have them process messages (and not an interface to any OS-supplied streams API). Bare-bones functionality like put / input_queue / work_method / successor would be fine.

Having found nothing on CPAN or elsewhere, I have written a little package for my own use. Now I am considering modularizing and posting it and would like to re-check for existing work.

Update: While looking for something completely different (state machines), I found POE. As it turns out, the design of POE::Filter has strong similarities to System V Stream Modules. However, there is at least one significant difference.

Some similarities: Both excel in processing layered protocols (cleanly separating the layers' concerns). This is no wonder because they were both designed for this purpose. A Filter may be compared to a Stream Module. Both perform a well-defined operation on the input, typically translation from one protocol (data format) to another. Both use a form of buffering. Both have simple get / put APIs. Both are typically used in a stacked (chained) configuration.

The difference: Filter operations are usually used as functions (called in a functional way). For example, a Filter's put method immediately returns the processed result(s). The Stream put method on the other hand 'feels' asynchronous. It is used solely for its side-effect(s). Depending on the details, it may return immediately, it does not return the result of the processing (with C, it would return void or an error code).

Maybe POE::Wheel is akin to Streams. It says on the man page: It would be nice if wheels were more like proper Unix streams. Still reading here.

Yes, I've seen that Filters also have other, somewhat asynchronous API functions, for example get_one_start(). Maybe Filters can be wrapped as Modules... maybe this is what Wheel does... wandering off mumbling...