{
    "mode": "perldoc",
    "parameter": "POE::Driver",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/POE%3A%3ADriver/json",
    "generated": "2026-06-12T15:40:36Z",
    "synopsis": "This is a contrived example of how POE::Filter and POE::Driver objects may be used in a\nstand-alone application.\nmy $driver = POE::Driver::SysRW->new();\nmy $filter = POE::Filter::Line->new();\nmy $listofoctetchunks = $filter->put(\"A line of text.\");\n$driver->put( $listofoctetchunks );\nmy $octetsremaininginbuffer = $driver->flush($filehandle);\ndie \"couldn't flush everything\" if $octetsremaininginbuffer;\nwhile (1) {\nmy $octetslist = $driver->get($filehandle);\ndie $! unless defined $octetslist;\n$filter->getonestart($octetslist);\nwhile (my $line = $filter->getone()) {\nprint \"Input: $line\\n\";\n}\n}\nMost programs will use POE::Filter and POE::Driver objects as parameters to POE::Wheel\nconstructors. See the synopses for particular classes for details.",
    "sections": {
        "NAME": {
            "content": "POE::Driver - an abstract interface for buffered, non-blocking I/O\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "This is a contrived example of how POE::Filter and POE::Driver objects may be used in a\nstand-alone application.\n\nmy $driver = POE::Driver::SysRW->new();\nmy $filter = POE::Filter::Line->new();\n\nmy $listofoctetchunks = $filter->put(\"A line of text.\");\n\n$driver->put( $listofoctetchunks );\n\nmy $octetsremaininginbuffer = $driver->flush($filehandle);\ndie \"couldn't flush everything\" if $octetsremaininginbuffer;\n\nwhile (1) {\nmy $octetslist = $driver->get($filehandle);\ndie $! unless defined $octetslist;\n\n$filter->getonestart($octetslist);\nwhile (my $line = $filter->getone()) {\nprint \"Input: $line\\n\";\n}\n}\n\nMost programs will use POE::Filter and POE::Driver objects as parameters to POE::Wheel\nconstructors. See the synopses for particular classes for details.\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "POE::Driver is a common API for I/O drivers that can read from and write to various files,\nsockets, pipes, and other devices.\n\nPOE \"drivers\" implement the specifics of reading and writing to devices. Drivers plug into\nPOE::Wheel objects so that wheels may support a large number of device types without\nimplementing a separate subclass for each.\n\nAs mentioned in the SYNOPSIS, POE::Driver objects may be used in stand-alone applications.\n",
            "subsections": [
                {
                    "name": "Public Driver Methods",
                    "content": "These methods are the generic Driver interface, and every driver must implement them. Specific\ndrivers may have additional methods related to their particular tasks.\n\nnew"
                },
                {
                    "name": "new",
                    "content": "constructor parameters. The default constructor parameters should configure the driver for the\nmost common use case.\n\nget FILEHANDLE"
                },
                {
                    "name": "get",
                    "content": "success---even if nothing was read from the FILEHANDLE. get() returns undef on error, and $!\nwill be set to the reason why get() failed.\n\nThe returned arrayref will be empty if nothing was read from the FILEHANDLE.\n\nIn an EOF condition, get() returns undef with the numeric value of $! set to zero.\n\nThe arrayref returned by get() is suitable for passing to any POE::Filter's get() or"
                },
                {
                    "name": "get_one_start",
                    "content": "put ARRAYREF\nput() accepts an ARRAYREF of raw octet chunks. These octets are added to the driver's\ninternal output queue or buffer. put() returns the number of octets pending output after the\nnew octets are buffered.\n\nSome drivers may flush data immediately from their put() methods.\n\nflush FILEHANDLE\nflush() attempts to write a driver's buffered data to a given FILEHANDLE. The driver should\nflush as much data as possible in a single flush() call.\n\nflush() returns the number of octets remaining in the driver's output queue or buffer after\nthe maximum amount of data has been written.\n\nflush() denotes success or failure by the value of $! after it returns. $! will always\nnumerically equal zero on success. On failure, $! will contain the usual Errno value. In\neither case, flush() will return the number of octets in the driver's output queue.\n\ngetoutmessagesbuffered\ngetoutmessagesbuffered() returns the number of messages enqueued in the driver's output\nqueue, rounded up to the nearest whole message. Some applications require the message count\nrather than the octet count.\n\nMessages are raw octet chunks enqueued by put(). The following put() call enqueues two\nmessages for a total of six octets:\n\n$filter->put( [ \"one\", \"two\" ] );\n\nIt is possible for a flush() call to write part of a message. A partial message still counts\nas one message.\n"
                }
            ]
        },
        "SEE ALSO": {
            "content": "The SEE ALSO section in POE contains a table of contents covering the entire POE distribution.\n\nPOE::Wheel - A base class for POE::Session mix-ins.\n\nPOE::Filter - A base class for data parsers and serializers.\n\nPOE::Driver::SysRW - A driver that encapsulates sysread() and buffered syswrite().\n",
            "subsections": []
        },
        "BUGS": {
            "content": "There is no POE::Driver::SendRecv, but nobody has needed one so far. sysread() and syswrite()\nmanage to do almost everything people need.\n\nIn theory, drivers should be pretty much interchangeable. In practice, there seems to be an\nimpermeable barrier between the different SOCK* types.\n\nAUTHORS & COPYRIGHTS\nPlease see POE for more information about authors and contributors.\n",
            "subsections": []
        }
    },
    "summary": "POE::Driver - an abstract interface for buffered, non-blocking I/O",
    "flags": [],
    "examples": [],
    "see_also": []
}