Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use POE qw(Component::Server::SimpleHTTP XS::Queue::Array Loop::IO_Poll);
- POE::Component::Server::SimpleHTTP->new(ALIAS => 'HTTPD', PORT => 8010, HANDLERS => [{ DIR => '/', SESSION => 'MANAGER', EVENT => 'req' }]);
- POE::Session->create(inline_states => {
- _start => sub { $_[KERNEL]->alias_set('MANAGER') },
- req => sub {
- for ($_[ARG1]) {
- $_->code(200);
- $_->header('content-type', 'text/plain');
- $_->content($_[ARG0]->uri);
- $_[KERNEL]->post('HTTPD' => 'DONE' => $_);
- }
- },
- });
- POE::Kernel->run;
- __END__
- Requests per second: 469.65 [#/sec] (mean)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement