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

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26