/[Frey]/trunk/bin/server-http-engine.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/bin/server-http-engine.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 628 - (hide annotations)
Sat Nov 29 22:43:13 2008 UTC (14 years, 2 months ago) by dpavlin
File MIME type: text/plain
File size: 554 byte(s)
HTTP::Engine server skeleton
1 dpavlin 628 #!/usr/bin/perl
2    
3     use warnings;
4     use strict;
5    
6     use HTTP::Engine;
7     use lib 'lib';
8     use Frey::Server;
9    
10     my $engine = HTTP::Engine->new(
11     interface => {
12     module => 'ServerSimple',
13     args => {
14     host => 'localhost',
15     port => 3001,
16     },
17     request_handler => 'main::handle_request',# or CODE ref
18     },
19     );
20    
21     $engine->run;
22    
23     sub handle_request {
24     my $req = shift;
25    
26     my $server = Frey::Server->new;
27     my $body;
28     $server->{_print} = sub {
29     $body .= join("\n", @_);
30     };
31    
32     $server->request( $req->uri, $req->params );
33    
34     HTTP::Engine::Response->new( body => $body );
35     }
36    

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26