Perlbal::Plugin::Cgilike - Online Linux Manual PageSection : 3
Updated : 2021-01-25
Source : perl v5.32.1
Note : User Contributed Perl Documentation
NAMEPerlbal::Plugin::Cgilike − Handle Perlbal requests with a Perl subroutine
DESCRIPTIONThis module allows responses to be handled with a simple API that's similar in principle to CGI, mod_perl response handlers, etc. It does not, however, come anywhere close to conforming to the CGI ‟standard”. It's actually more like mod_perl in usage, though there are several differences. Most notably, Perlbal is single-process and single-threaded, and handlers run inside the Perlbal process and must therefore return quickly and not do any blocking operations. As it currently stands, this is very bare-bones and has only really been used with basic GET requests. It lacks a nice API for handling the body of a POST or PUT request. It is not recommended to use this for extensive applications. Perlbal is first and foremost a load balancer, so if you're doing something at all complicated you're probably better off using something like Apache mod_perl and then putting Perlbal in front if it if necessary. However, this plugin may prove useful for simple handlers or perhaps embedding a simple HTTP service into another application that uses Danga::Socket.
SYNOPSISThis module provides a Perlbal plugin which can be loaded and used as follows. LOAD cgilike
PERLREQUIRE = MyPackage
CREATE SERVICE cgilike
SET role = web_server
SET listen = 127.0.0.1:80
SET plugins = cgilike
PERLHANDLER = MyPackage::handler
ENABLE cgilike
With this plugin loaded into a particular service, the plugin will then be called for all requests for that service. Set cgilike.handler to the name of a subroutine that will handle requests. This subroutine will receive an object which allows interaction with the Perlbal service. package MyPackage
sub handler {
my ($r) = @_;
if ($r−>uri eq '/') {
print "<p>Hello, world</p>";
return Perlbal::Plugin::Cgilike::HANDLED;
}
else {
return 404;
}
}
Return Perlbal::Plugin::Cgilike::HANDLED to indicate that the request has been handled, or return some HTTP error code to produce a predefined error message. You may also return Perlbal::Plugin::Cgilike::DECLINED if you do not wish to handle the request, in which case Perlbal will be allowed to handle the request in whatever way it would have done without Cgilike loaded. If your handler returns any non-success value, it MUST NOT produce any output. If you produce output before returning such a value, the response to the client is likely to be utter nonsense. You may also return Perlbal::Plugin::Cgilike::POSTPONE_RESPONSE, which is equivalent to returning zero except that the HTTP connection will be left open once you return. It is your responsibility to later call $r−>end_response() when you have completed the response. This style is necessary when you need to perform some long operation before you can return a response; you'll need to use some appropriate method to set a callback to run when the operation completes and then do your response in the callback. Once you've called end_response, you must not call any further methods on $r; it's probably safest to just return immediately afterwards to avoid any mishaps.
API DOCUMENTATIONTODO: Write this
TODOCurrently there is no API for dealing with the body of a POST or PUT request. Ideally it'd be able to do automatic decoding of application/x−www−form−urlencoded data, too. The POSTPONE_RESPONSE functionality has not been tested extensively and is probably buggy.
COPYRIGHT AND LICENSECopyright 2007 Martin Atkins <mart@degeneration.co.uk> and Six Apart Ltd. This module is part of the Perlbal distribution, and as such can be distributed under the same licence terms as the rest of Perlbal. 0
Johanes Gumabo
Data Size : 9,963 byte
man-Perlbal::Plugin::Cgilike.3pmBuild : 2024-12-05, 20:55 :
Visitor Screen : x
Visitor Counter ( page / site ) : 3 / 170,434
Visitor ID : :
Visitor IP : 3.22.42.25 :
Visitor Provider : AMAZON-02 :
Provider Position ( lat x lon ) : 39.962500 x -83.006100 : x
Provider Accuracy Radius ( km ) : 1000 :
Provider City : Columbus :
Provider Province : Ohio , : ,
Provider Country : United States :
Provider Continent : North America :
Visitor Recorder : Version :
Visitor Recorder : Library :
Online Linux Manual Page : Version : Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page : Library : lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page : Library : lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base : Version : Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base : Library : lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36
Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.
ERROR : Need New Coding : (parse_manual_page_|249|Perlbal::Plugin::Cgilike.3pm|36/37|el══─{─══.|.el══─{─══. ds -- \|\(em\|
) (htmlprn|149|Perlbal::Plugin::Cgilike.3pm|36/37|.el══─{─══. ds -- — |.el══─{─══. ds -- \|\(em\|
) (parse_manual_page_|249|Perlbal::Plugin::Cgilike.3pm|43|br══─}─══|'br══─}─══
) (htmlprn|149|Perlbal::Plugin::Cgilike.3pm|43|'br══─}─══ |'br══─}─══
)