NetSDS::App::FCGI(3pm) | User Contributed Perl Documentation | NetSDS::App::FCGI(3pm) |
NetSDS::App::FCGI - FastCGI applications superclass
# Run application MyFCGI->run(); 1; # Application package itself package MyFCGI; use base 'NetSDS::App::FCGI'; sub process { my ($self) = @_; $self->data('Hello World'); $self->mime('text/plain'); $self->charset('utf-8'); }
"NetSDS::App::FCGI" module contains superclass for FastCGI applications. This class is based on "NetSDS::App" module and inherits all its functionality like logging, configuration processing, etc.
my $https_header = $self->cgi->https('X-Some-Header');
Returns: response status value
$self->status('200 OK');
$self->mime('text/xml'); # output will be XML data
$self->mime('text/plain'); $self->charset('koi8-r'); # ouput as KOI8-R text
$self->mime('text/plain'); $self->data('Hello world!');
This method send reponse with 302 status and new location.
if (havent_data()) { $self->redirect('http://www.google.com'); # to google! };
Returns:
This method provides.....
$self->headers({ 'X-Beer' => 'Guiness', );
This method implements common FastCGI (or CGI) loop.
$self->set_cookie(name => 'sessid', value => '343q5642653476', expires => '+1h');
Returns cookie value by it's name
my $sess = $self->get_cookie('sessid');
Returns: CGI parameter value
This method returns CGI parameter value by it's name.
my $cost = $self->param('cost');
Returns: URL parameter value
This method works similar to param() method, but returns only parameters from the query string.
my $action = $self->url_param('a');
Returns: header value
This method returns HTTP request header value by name.
my $beer = $self->http('X-Beer');
my $beer = $self->https('X-Beer');
my $ua_info = $self->user_agent();
if ($self->request_method eq 'POST') { $self->log("info", "Something POST'ed from client"); }
if ($self->path_info eq '/help') { $self->data('Help yourself'); }
warn "Client from: " . $self->remote_host();
if ($self->remote_addr eq '10.0.0.1') { $self->data('Welcome people from our gateway!'); }
See "samples" catalog for more example code.
CGI, CGI::Fast, NetSDS::App
Michael Bochkaryov <misha@rattler.kiev.ua>
Copyright (C) 2008-2009 Net Style Ltd.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2021-12-26 | perl v5.32.1 |