.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "NetSDS::App::FCGI 3pm" .TH NetSDS::App::FCGI 3pm "2010-04-28" "perl v5.10.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" NetSDS::App::FCGI \- FastCGI applications superclass .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& # Run application \& MyFCGI\->run(); \& \& 1; \& \& # Application package itself \& package MyFCGI; \& \& use base \*(AqNetSDS::App::FCGI\*(Aq; \& \& sub process { \& my ($self) = @_; \& \& $self\->data(\*(AqHello World\*(Aq); \& $self\->mime(\*(Aqtext/plain\*(Aq); \& $self\->charset(\*(Aqutf\-8\*(Aq); \& \& } .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\f(CW\*(C`NetSDS::App::FCGI\*(C'\fR module contains superclass for FastCGI applications. This class is based on \f(CW\*(C`NetSDS::App\*(C'\fR module and inherits all its functionality like logging, configuration processing, etc. .SH "CLASS API" .IX Header "CLASS API" .IP "\fBnew(%params)\fR \- class constructor" 4 .IX Item "new(%params) - class constructor" Normally constructor of application framework shouldn't be invoked directly. .IP "\fB\f(BIcgi()\fB\fR \- accessor to \s-1CGI\s0.pm request handler" 4 .IX Item "cgi() - accessor to CGI.pm request handler" .Vb 1 \& my $https_header = $self\->cgi\->https(\*(AqX\-Some\-Header\*(Aq); .Ve .IP "\fBstatus([$new_status])\fR \- set response \s-1HTTP\s0 status" 4 .IX Item "status([$new_status]) - set response HTTP status" Paramters: new status to set .Sp Returns: response status value .Sp .Vb 1 \& $self\->status(\*(Aq200 OK\*(Aq); .Ve .IP "\fB\f(BImime()\fB\fR \- set response \s-1MIME\s0 type" 4 .IX Item "mime() - set response MIME type" Paramters: new \s-1MIME\s0 type for response .Sp .Vb 1 \& $self\->mime(\*(Aqtext/xml\*(Aq); # output will be XML data .Ve .IP "\fB\f(BIcharset()\fB\fR \- set response character set if necessary" 4 .IX Item "charset() - set response character set if necessary" .Vb 2 \& $self\->mime(\*(Aqtext/plain\*(Aq); \& $self\->charset(\*(Aqkoi8\-r\*(Aq); # ouput as KOI8\-R text .Ve .IP "\fBdata($new_data)\fR \- set response data" 4 .IX Item "data($new_data) - set response data" Paramters: new data \*(L"as is\*(R" .Sp .Vb 2 \& $self\->mime(\*(Aqtext/plain\*(Aq); \& $self\->data(\*(AqHello world!\*(Aq); .Ve .IP "\fBredirect($redirect_url)\fR \- send \s-1HTTP\s0 redirect" 4 .IX Item "redirect($redirect_url) - send HTTP redirect" Paramters: new \s-1URL\s0 (relative or absolute) .Sp This method send reponse with 302 status and new location. .Sp .Vb 3 \& if (havent_data()) { \& $self\->redirect(\*(Aqhttp://www.google.com\*(Aq); # to google! \& }; .Ve .IP "\fB\f(BIcookie()\fB\fR \-" 4 .IX Item "cookie() -" Paramters: .Sp Returns: .Sp This method provides..... .IP "\fBheaders($headers_hashref)\fR \- set/get response \s-1HTTP\s0 headers" 4 .IX Item "headers($headers_hashref) - set/get response HTTP headers" Paramters: new headers as hash reference .Sp .Vb 3 \& $self\->headers({ \& \*(AqX\-Beer\*(Aq => \*(AqGuiness\*(Aq, \& ); .Ve .IP "\fB\f(BImain_loop()\fB\fR \- main FastCGI loop" 4 .IX Item "main_loop() - main FastCGI loop" Paramters: none .Sp This method implements common FastCGI (or \s-1CGI\s0) loop. .IP "\fBset_cookie(%params)\fR \- set cookie" 4 .IX Item "set_cookie(%params) - set cookie" Paramters: hash (name, value, expires) .Sp .Vb 1 \& $self\->set_cookie(name => \*(Aqsessid\*(Aq, value => \*(Aq343q5642653476\*(Aq, expires => \*(Aq+1h\*(Aq); .Ve .IP "\fBget_cookie(%params)\fR \- get cookie by name" 4 .IX Item "get_cookie(%params) - get cookie by name" Paramters: cookie name .Sp Returns cookie value by it's name .Sp .Vb 1 \& my $sess = $self\->get_cookie(\*(Aqsessid\*(Aq); .Ve .IP "\fBparam($name)\fR \- \s-1CGI\s0 request parameter" 4 .IX Item "param($name) - CGI request parameter" Paramters: \s-1CGI\s0 parameter name .Sp Returns: \s-1CGI\s0 parameter value .Sp This method returns \s-1CGI\s0 parameter value by it's name. .Sp .Vb 1 \& my $cost = $self\->param(\*(Aqcost\*(Aq); .Ve .IP "\fBurl_param($name)\fR \- \s-1CGI\s0 request parameter" 4 .IX Item "url_param($name) - CGI request parameter" Paramters: \s-1URL\s0 parameter name .Sp Returns: \s-1URL\s0 parameter value .Sp This method works similar to \fB\f(BIparam()\fB\fR method, but returns only parameters from the query string. .Sp .Vb 1 \& my $action = $self\->url_param(\*(Aqa\*(Aq); .Ve .IP "\fBhttp($http_field)\fR \- request \s-1HTTP\s0 header" 4 .IX Item "http($http_field) - request HTTP header" Paramters: request header name .Sp Returns: header value .Sp This method returns \s-1HTTP\s0 request header value by name. .Sp .Vb 1 \& my $beer = $self\->http(\*(AqX\-Beer\*(Aq); .Ve .IP "\fBhttps($https_field)\fR \- request \s-1HTTPS\s0 header" 4 .IX Item "https($https_field) - request HTTPS header" This method returns \s-1HTTPS\s0 request header value by name and is almost the same as \fIhttp()\fR method except of it works with \s-1SSL\s0 requests. .Sp .Vb 1 \& my $beer = $self\->https(\*(AqX\-Beer\*(Aq); .Ve .IP "\fB\f(BIraw_cookie()\fB\fR \- get raw cookie data" 4 .IX Item "raw_cookie() - get raw cookie data" Just proxying \f(CW\*(C`raw_cookie()\*(C'\fR method from \s-1CGI\s0.pm .IP "\fB\f(BIuser_agent()\fB\fR \- User-Agent request header" 4 .IX Item "user_agent() - User-Agent request header" .Vb 1 \& my $ua_info = $self\->user_agent(); .Ve .IP "\fB\f(BIrequest_method()\fB\fR \- \s-1HTTP\s0 request method" 4 .IX Item "request_method() - HTTP request method" .Vb 3 \& if ($self\->request_method eq \*(AqPOST\*(Aq) { \& $self\->log("info", "Something POST\*(Aqed from client"); \& } .Ve .IP "\fB\f(BIscript_name()\fB\fR \- \s-1CGI\s0 script name" 4 .IX Item "script_name() - CGI script name" Returns: script name from \s-1CGI\s0.pm .IP "\fB\f(BIpath_info()\fB\fR \- get \s-1PATH_INFO\s0 value" 4 .IX Item "path_info() - get PATH_INFO value" .Vb 3 \& if ($self\->path_info eq \*(Aq/help\*(Aq) { \& $self\->data(\*(AqHelp yourself\*(Aq); \& } .Ve .IP "\fB\f(BIremote_host()\fB\fR \- remote (client) host name" 4 .IX Item "remote_host() - remote (client) host name" .Vb 1 \& warn "Client from: " . $self\->remote_host(); .Ve .IP "\fB\f(BIremote_addr()\fB\fR \- remote (client) \s-1IP\s0 address" 4 .IX Item "remote_addr() - remote (client) IP address" Returns: \s-1IP\s0 address of client from \s-1REMOTE_ADDR\s0 environment .Sp .Vb 3 \& if ($self\->remote_addr eq \*(Aq10.0.0.1\*(Aq) { \& $self\->data(\*(AqWelcome people from our gateway!\*(Aq); \& } .Ve .IP "\fB\f(BI_set_req_cookies()\fB\fR \- fetching request cookies (internal method)" 4 .IX Item "_set_req_cookies() - fetching request cookies (internal method)" Fetching cookies from \s-1HTTP\s0 request to object \f(CW\*(C`req_cookies\*(C'\fR variable. .SH "EXAMPLES" .IX Header "EXAMPLES" See \f(CW\*(C`samples\*(C'\fR catalog for more example code. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\s-1CGI\s0, CGI::Fast, NetSDS::App .SH "AUTHOR" .IX Header "AUTHOR" Michael Bochkaryov .SH "LICENSE" .IX Header "LICENSE" Copyright (C) 2008\-2009 Net Style Ltd. .PP This program is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but \s-1WITHOUT\s0 \s-1ANY\s0 \s-1WARRANTY\s0; without even the implied warranty of \&\s-1MERCHANTABILITY\s0 or \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0. See the \&\s-1GNU\s0 General Public License for more details. .PP You should have received a copy of the \s-1GNU\s0 General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, \s-1MA\s0 02111\-1307 \s-1USA\s0