Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Re: POE::Component::Server::HTTP: The _signal event is deprecated

by strat (Canon)
on Dec 15, 2002 at 22:54 UTC ( [id://220072]=note: print w/replies, xml ) Need Help??

in reply to Re: POE::Component::Server::HTTP: The _signal event is deprecated
in thread POE::Component::Server::HTTP: The _signal event is deprecated

I'd write a webserver with POE in a different way with Filter::HTTPD. Perhaps the following code from POE Cookbook/Web Server might interest you:
#!/usr/bin/perl use warnings; use strict; use POE qw(Component::Server::TCP Filter::HTTPD); use HTTP::Response; # Spawn a web server on port 8088 of all interfaces. POE::Component::Server::TCP->new ( Alias => "web_server", Port => 8088, ClientFilter => 'POE::Filter::HTTPD', # The ClientInput function is called to deal with client input. # Because this server uses POE::Filter::HTTPD to parse input, # ClientInput will receive HTTP requests. ClientInput => sub { my ( $kernel, $heap, $request ) = @_[ KERNEL, HEAP, ARG0 ]; # Filter::HTTPD sometimes generates HTTP::Response objects. # They indicate (and contain the response for) errors that occ +ur # while parsing the client's HTTP request. It's easiest to se +nd # the responses as they are and finish up. if ( $request->isa("HTTP::Response") ) { $heap->{client}->put($request); $kernel->yield("shutdown"); return; } # The request is real and fully formed. Build content based o +n # it. Insert your favorite template module here, or write you +r # own. :) my $request_fields = ''; $request->headers()->scan ( sub { my ( $header, $value ) = @_; $request_fields .= "<tr><td>$header</td><td>$value</td +></tr>"; } ); my $response = HTTP::Response->new(200); $response->push_header( 'Content-type', 'text/html' ); $response->content ( "<html><head><title>Your Request</title></head>" . "<body>Details about your request:" . "<table border='1'>$request_fields</table>" . "</body></html>" ); # Once the content has been built, send it back to the client # and schedule a shutdown. $heap->{client}->put($response); $kernel->yield("shutdown"); } ); # Start POE. This will run the server until it exits. $poe_kernel->run(); exit 0;

Best regards,
perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8."

  • Comment on Re: Re: POE::Component::Server::HTTP: The _signal event is deprecated
  • Download Code

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://220072]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-13 04:34 GMT
Find Nodes?
    Voting Booth?

    No recent polls found