Crop

 view release on metacpan or  search on metacpan

lib/Crop/HTTP/Request.pm  view on Meta::CPAN

package Crop::HTTP::Request;
use base qw/ Crop::Object::Simple /;

=begin nd
Class: Crop::HTTP::Request
	HTTP request.

	Base class for particular gateways such FastCGI, PSGI, CGI.
	
	Attributes contain start and finish time besides regular HTTP data.
=cut

use v5.14;
use warnings;

lib/Crop/HTTP/Request/FastCGI.pm  view on Meta::CPAN

package Crop::HTTP::Request::FastCGI;
use base qw/ Crop::HTTP::Request /;

=begin nd
Class: Crop::HTTP::Request::FastCGI
	HTTP request for Fast CGI protocol.
=cut

use v5.14;
use warnings;

use Crop::Server::FastCGI;

=begin nd
Constructor: new (%attr)

lib/Crop/HTTP/Request/PSGI.pm  view on Meta::CPAN

package Crop::HTTP::Request::PSGI;
use base qw/ Crop::Object /;

=begin nd
Class: Crop::HTTP::Request::PSGI
	PSGI specific request.
	
	NOT IMPLEMENTED.
=cut

use v5.14;
use warnings;

use Crop::Error;

lib/Crop/Server.pm  view on Meta::CPAN

	data      - persistent data across all the handlers of an client request
	json      - JSON exemplar
	handler   - hash of registered handlers
	headers   - HTTP headers for response
	iflow     - Input flow of data (see <I ( )>)
	oflow     - Output flow of data (see <O ( )>)
	            special item named {ERROR} contains hashref of all the errors ocquired (see <Crop::Error>)
	output_t  - type of output ('XML', 'XSLT', 'JSON', and so on)
	page      - filename of output template in cwd
	redirect  - URL to redirect
	request   - client request object, <Crop::HTTP::Request> exemplar; will be Saved manually, so stable=>1
	rights    - rights granted to the client, exemplar of <Crop::Rights>
	router    - method establishes a chain of handlers calls; the reuslt of method is array of handler names
	sendfile  - exemplar of <Crop::File::Send> allowes to download file <Crop::File> from inner url (for Nginx)
	session   - exemplar of <Crop::HTTP::Session>
	tik       - start time of request as <Crop::DateTime> object; server sets a corresponding tok at done time
	user      - user object
	workqueue - array of handlers names establishes executing order
	xslt      - hash of parsed XSLT templates
	
	The 'stable' attribute means 'do not cleanup after request has done'.

lib/Crop/Server.pm  view on Meta::CPAN

sub interrupt {
	my $signal = shift;

	warn "SERVER|NOTICE: The $signal signal received";

	$AtWork ? $Interrupted = 1 : die 'SERVER|NOTICE: Server stoped';
};

=begin nd
Method: _init_httprequest ( )
	Create <Crop::HTTP::Request> object from client data.
	
	Pure virtual method.
=cut
sub _init_httprequest { warn 'Crop::Server::_init_httprequest() must be redefined by a subclass' }

=begin nd
Method: instance ( )
	Get Singlton.

Returns:

lib/Crop/Server/FastCGI.pm  view on Meta::CPAN

Class: Crop::Server::FastCGI
	Server uses FastCGI protocol.
=cut

use v5.14;
use warnings;

use CGI::Fast;

use Crop::Debug;
use Crop::HTTP::Request::FastCGI;

=begin nd
Variable: our %Attributes
	Class attributes:

	cgi - object of Common Gateway Interface
=cut
our %Attributes = (
	cgi => {mode => 'read'},
);

lib/Crop/Server/FastCGI.pm  view on Meta::CPAN


=begin
Method: _init_httprequest ( )
	Create Request object.
	
	Set start time to Request.
=cut
sub _init_httprequest {
	my $self = shift;
	
	$self->{request} = Crop::HTTP::Request::FastCGI->new(tik => $self->{tik}->timestamp);
}

=begin nd
Method: listen ( )
	Main loop is specific for Gateway Interface.

Returns:
	Nerver returns.
=cut
sub listen {



( run in 0.295 second using v1.01-cache-2.11-cpan-de7293f3b23 )