Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

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

by Matts (Deacon)
on Dec 15, 2002 at 16:18 UTC ( #220019=note: print w/ replies, xml ) Need Help??


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

There's a couple of things wrong here. The main one being that you're not actually starting the kernel (admittedly PoCo::Server::HTTPD's docs are lacking a bit in this respect). What you need to do is create a session and then start the kernel:

POE::Session->create( inline_states => { _start => \&create_httpd, _stop => \&stop_httpd, }, args => [8080], ); $poe_kernel->run; sub create_httpd { my ($kernel, $heap, $Port) = @_[KERNEL, HEAP, ARG0]; $kernel->alias_set('httpd_parent'); my $httpd = POE::Component::Server::HTTP->new ( Port => $Port, ContentHandler => { '/' => \&MainHandler }, Headers => {Server => 'any server' }, ); $heap->{httpd} = $httpd; } sub stop_httpd { my ($kernel, $heap) = @_[KERNEL, HEAP]; $kernel->call($heap->{httpd}, 'shutdown'); } sub MainHandler { my ($request, $response) = @_; $response->code(RC_OK); $response->content("Hi, you fetched ". $request->uri); return RC_OK; } # MainHandler
The other thing wrong is a bug in PoCo::Server::HTTP - it uses the deprecated _signal event, but luckily for you it simply sets it to an empty sub, so you can comment that line out (just grep for _signal in the HTTP.pm file in the distro). (Note: I haven't tested the above code, so it might not work. But it should).


Comment on Re: POE::Component::Server::HTTP: The _signal event is deprecated
Download Code
Re: Re: POE::Component::Server::HTTP: The _signal event is deprecated
by strat (Canon) on Dec 15, 2002 at 22:54 UTC

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2014-09-19 16:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (143 votes), past polls