HTTP::Proxy::Engine(3pm) | User Contributed Perl Documentation | HTTP::Proxy::Engine(3pm) |
HTTP::Proxy::Engine - Generic child process manager engine for HTTP::Proxy
use HTTP::Proxy; # use the default engine for your system my $proxy = HTTP::Proxy->new(); # choose one my $proxy = HTTP::Proxy->new( engine => 'Old' );
The HTTP::Proxy::Engine class is a front-end to actual proxy engine classes.
The role of an engine is to implement the main fork+serve loop with all the required bookkeeping. This is also a good way to test various implementation and/or try out new algorithms without too much difficulties.
This method also implement the subclasses constructor (they obviously do not need the "engine" parameter).
It is possible to create one's own engine, by creating a simple subclass of HTTP::Proxy::Engine with the following methods:
The engine MUST have a run() method, and it will be called again and again until the proxy exits.
"$self->proxy->daemon" returns the listening socket that can "accept()" connections. The child must call "$self->proxy->serve_connections()" on the returned socket to handle actual TCP connections.
A subclass may also define a %defaults hash (with "our") that contains the default values for the fields used internaly.
HTTP::Proxy::Engine provides the following methods to its subclasses:
Some engines may understand a value of 0 as do not fork at all. This is what HTTP::Proxy::Engine::Legacy does.
This is a class method.
Philippe "BooK" Bruhat, "<book@cpan.org>".
Copyright 2005-2015, Philippe Bruhat.
This module is free software; you can redistribute it or modify it under the same terms as Perl itself.
2022-12-04 | perl v5.36.0 |