Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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."

In reply to Re: Re: POE::Component::Server::HTTP: The _signal event is deprecated by strat
in thread POE::Component::Server::HTTP: The _signal event is deprecated by ls

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (6)
As of 2024-04-16 07:27 GMT
Find Nodes?
    Voting Booth?

    No recent polls found