Skip to content

Latest commit

 

History

History

test_io_all

README

# Demo

0. Install [IO::All][1] by `cpanm` or `cpan --local:lib` or other way.
   ```
   cpanm IO::All
   cpanm IO::All::LWP
   ```

1. Run tiny server by one-liner
   ```
   sh ./one_liner_tiny_web_server.sh
   # OR
   perl -MIO::All -e 'io(":8080")->fork->accept->(sub { $_[0] < io(-x $1 ? "./$1 |" : $1) if /^GET \/(.*) / })'
   ```

2. Result from web client:
   ```
   perl client_socket_for_web.pl
   ```
   
   Example: 
   ```
   > perl client_socket_for_web.pl
   use IO::All;
   use IO::All::LWP;
   
   my $io = io('localhost:12345');
   print while $_ = $io->getline;
   ```


[1]: https://github.com/ingydotnet/io-all-pm "GitHub - ingydotnet/io-all-pm: All in One Perl IO"