1OpenFrame(3)          User Contributed Perl Documentation         OpenFrame(3)
2
3
4

NAME

6       OpenFrame - a framework for network enabled applications
7

SYNOPSIS

9         use OpenFrame;
10

DESCRIPTION

12       OpenFrame is a framework for network services serving to multiple media
13       channels - for instance, the web, WAP, and digital television.  It is
14       built around the Pipeline API, and provides extra abstraction to make
15       delivery of a single application to multiple channels easier.
16

GLOBAL VARIABLES

18       The most important thing that this module does is provide a wrapper
19       around OpenFrame specific debug information - for example, the
20       information provided by OpenFrame segments.
21
22       This variable is a hash called %DEBUG in the OpenFrame package.  If you
23       set the ALL key to a true value, then debugging information about all
24       segments will be printed.  If you want to resolve your debugging output
25       to a single module, then set a key that matches the segments name to a
26       true value.  For example, setting
27       $OpenFrame::DEBUG{'OpenFrame::Segment::HTTP::Request'} to 1 would mean
28       that all the debug messages from the HTTP::Request segment would get
29       printed.
30

SETTING UP YOUR SERVER

32       This will briefly explain how to set up a stand-alone OpenFrame server.
33       It uses the code listing below.
34
35       The first few lines (01-08) simply load all the modules that are needed
36       to setup the various constituent parts of an OpenFrame server.  Lines 9
37       creates an HTTP daemon listening on port 8080 for requests, in the case
38       that the server cannot be created line 10 provides error reporting to
39       the screen.
40
41       The first real piece of OpenFrame code is found at line 14, where we
42       create a Pipeline object, followed quickly by lines 16, 17 and 18 which
43       create a couple of pipeline segments that will be added to the pipeline
44       at line 21. Lines 24 and 26 create a loop to listen for and accept
45       connections, and fetch HTTP requests from those connections as and when
46       it is needed.
47
48       At line 28 we create a Pipeline::Store::Simple object, which will act
49       as our data container for the information flowing down the pipeline. We
50       add the request to the store and the store to the pipeline at line 31,
51       and then call the dispatch() method on the pipeline at line 34. This
52       sets the OpenFrame side of things going. At line 37 we ask the pipeline
53       for the store and the store for an HTTP::Response object, and then send
54       it back to the client at line 40.
55
56       The real work of OpenFrame is in the segments that are created, and the
57       order in which they are inserted into the Pipeline. With this in mind,
58       you know everything there is to know about OpenFrame.
59

CODE LISTING

61         01: use strict;
62         02: use warnings;
63         03:
64         04: use Pipeline;
65         05: use HTTP::Daemon;
66         06: use OpenFrame::Segment::HTTP::Request;
67         07: use OpenFrame::Segment::ContentLoader;
68         08:
69         09: my $d = HTTP::Daemon->new( LocalPort => '8080', Reuse => 1);
70         10: die $! unless $d;
71         11:
72         12: print "server running at http://localhost:8080/\n";
73         13:
74         14: my $pipeline = Pipeline->new();
75         15:
76         16: my $hr = OpenFrame::Segment::HTTP::Request->new();
77         17: my $cl = OpenFrame::Segment::ContentLoader->new()
78         18:                                        ->directory("./webpages");
79         19:
80         20:
81         21: $pipeline->add_segment( $hr, $cl );
82         22:
83         23:
84         24: while(my $c = $d->accept()) {
85         25:
86         26:   while(my $r = $c->get_request) {
87         27:
88         28:     my $store = Pipeline::Store::Simple->new();
89         29:
90         30:
91         31:     $pipeline->store( $store->set( $r ) );
92         32:
93         33:
94         34:     $pipeline->dispatch();
95         35:
96         36:
97         37:     my $response = $pipeline->store->get('HTTP::Response');
98         38:
99         39:
100         40:     $c->send_response( $response );
101         41:   }
102         42: }
103

SEE ALSO

105       perl(1) Pipeline(3) OpenFrame::Config(3)
106

AUTHOR

108       James A. Duncan <jduncan@fotango.com>
109
110
111
112perl v5.34.0                      2021-07-22                      OpenFrame(3)
Impressum