IO::Stream

Ease non-blocking I/O streams based on EV
Download

IO::Stream Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Alex Efros
  • Publisher web site:
  • http://search.cpan.org/~powerman/

IO::Stream Tags


IO::Stream Description

Non-blocking event-based low-level I/O is hard to get right. Code usually error-prone and complex... and it very similar in all applications. Things become much worse when you need to alter I/O stream in some way - use proxies, encryption, SSL, etc.IO::Stream is a Perl module designed to give user ability to work with I/O streams on higher level, using input/output buffers (just scalars) and high-level events like CONNECTED, SENT or EOF. As same time it doesn't hide low-level things, and user still able to work on low-level without any limitations.SYNOPSIS use EV; use IO::Stream; IO::Stream->new({ host => 'google.com', port => 80, cb => \&client, wait_for => SENT|EOF, in_buf_limit=> 102400, out_buf => "GET / HTTP/1.0\nHost: google.com\n\n", }); $EV::DIED = sub { warn $@; EV::unloop }; EV::loop; sub client { my ($io, $e, $err) = @_; if ($err) { $io->close(); die $err; } if ($e & SENT) { print "request sent, waiting for reply...\n"; } if ($e & EOF) { print "server reply:\n", $io->{in_buf}; $io->close(); EV::unloop; # ALL DONE } }Product's homepage


IO::Stream Related Software