1HTTP::Proxy::Engine(3)User Contributed Perl DocumentationHTTP::Proxy::Engine(3)
2
3
4

NAME

6       HTTP::Proxy::Engine - Generic child process manager engine for
7       HTTP::Proxy
8

SYNOPSIS

10           use HTTP::Proxy;
11
12           # use the default engine for your system
13           my $proxy = HTTP::Proxy->new();
14
15           # choose one
16           my $proxy = HTTP::Proxy->new( engine => 'Old' );
17

DESCRIPTION

19       The HTTP::Proxy::Engine class is a front-end to actual proxy engine
20       classes.
21
22       The role of an engine is to implement the main fork+serve loop with all
23       the required bookkeeping. This is also a good way to test various
24       implementation and/or try out new algorithms without too much difficul‐
25       ties.
26

METHODS

28       new()
29           Create a new engine. The parameter "engine" is used to decide which
30           kind of engine will be created. Other parameters are passed to the
31           underlying engine.
32
33           This method also implement the subclasses constructor (they obvi‐
34           ously do not need the "engine" parameter).
35

CREATING YOUR OWN ENGINE

37       It is possible to create one's own engine, by creating a simple sub‐
38       class of HTTP::Proxy::Engine with the following methods:
39
40       start()
41           This method should handle any initialisation required when the
42           engine starts.
43
44       run()
45           This method is the main loop of the master process.  It defines how
46           child processes are forked, checked and killed.
47
48           The engine MUST have a run() method, and it will be called again
49           and again until the proxy exits.
50
51           $self->proxy->daemon returns the listening socket that can accept()
52           connections. The child must call $self->proxy->serve_connections()
53           on the returned socket to handle actual TCP connections.
54
55       stop()
56           This optional method should handle any cleanup procedures when the
57           engine stops (typically when the main proxy process is killed).
58
59       A subclass may also define a %defaults hash (with "our") that contains
60       the default values for the fields used internaly.
61

METHODS PROVIDED TO SUBCLASSES

63       HTTP::Proxy::Engine provides the following methods to its subclasses:
64
65       proxy()
66           Return the HTTP::Proxy object that runs the engine.
67
68       max_clients()
69           Get or set the maximum number of TCP clients, that is to say the
70           maximum number of forked child process.
71
72           Some engines may understand a value of 0 as do not fork at all.
73           This is what HTTP::Proxy::Engine::Legacy does.
74
75       make_accessors( @names )
76           Create accessors named after @names in the subclass package.  All
77           accessors are read/write. This is a utility method.
78
79           This is a class method.
80

AUTHOR

82       Philippe "BooK" Bruhat, "<book@cpan.org>".
83
85       Copyright 2005, Philippe Bruhat.
86

LICENSE

88       This module is free software; you can redistribute it or modify it
89       under the same terms as Perl itself.
90
91
92
93perl v5.8.8                       2006-09-04            HTTP::Proxy::Engine(3)
Impressum