Advertisement
Guest User

Untitled

a guest
Apr 17th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #!/usr/bin/perl
  2. use strict;
  3. use POE qw(Component::Server::SimpleHTTP XS::Queue::Array Loop::IO_Poll);
  4.  
  5. POE::Component::Server::SimpleHTTP->new(ALIAS => 'HTTPD', PORT => 8010, HANDLERS => [{ DIR => '/', SESSION => 'MANAGER', EVENT => 'req' }]);
  6. POE::Session->create(inline_states => {
  7. _start => sub { $_[KERNEL]->alias_set('MANAGER') },
  8. req => sub {
  9. for ($_[ARG1]) {
  10. $_->code(200);
  11. $_->header('content-type', 'text/plain');
  12. $_->content($_[ARG0]->uri);
  13.  
  14. $_[KERNEL]->post('HTTPD' => 'DONE' => $_);
  15. }
  16. },
  17. });
  18. POE::Kernel->run;
  19.  
  20. __END__
  21. Requests per second: 469.65 [#/sec] (mean)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement