OpenFrame::AbstractRequest - An abstract request class
use OpenFrame::AbstractRequest; use OpenFrame::AbstractCookie; my $uri = URI->new("http://localhost/"); my $r = OpenFrame::AbstractRequest->new(uri => $uri, originator => 'http://www.example.com/', descriptive => 'web', argumentss => { colour => 'red' }, cookies => OpenFrame::AbstractCookie->new()); print "URI: " . $r->uri(); print "Originator: " . $r->originator(); print "Descriptive: " . $r->descriptive(); my $args = $r->arguments(); my $cookies = $r->cookies();
OpenFrame::AbstractRequest represents requests inside OpenFrame. Requests represent some kind of request for information given a URI.
OpenFrame::AbstractRequest
This module abstracts the way clients can request data from OpenFrame. For example OpenFrame::Server::Apache converts Apache::Request GET and POST requests into an OpenFrame::AbstractRequest, which is then used through OpenFrame.
OpenFrame::Server::Apache
The new() method creates a new OpenFrame::AbstractRequest object. It takes a variety of parameters, of which only the "uri" parameter is mandatory.
The parameters are:
The location this request is for. This must be a URI object.
A string describing the originator of the request. Defaults to "GenericServer".
A string describing the type of the request. Defaults to "web".
A hash reference which are the arguments passed along with the request.
An OpenFrame::AbstractCookie object which contains any cookies passed with the request.
OpenFrame::AbstractCookie
my $uri = URI->new("http://localhost/"); my $r = OpenFrame::AbstractRequest->new(uri => $uri, originator => 'secret agent', descriptive => 'web', arguments => { colour => 'red' }, cookies => OpenFrame::AbstractCookie->new());
This method gets and sets the URI.
print "URI: " . $r->uri(); $r->uri(URI->new("http://foo.com/"));
This method gets and sets the originator string.
print "Originator: " . $r->originator(); $r->setOriginator("me");
This method gets and sets the descriptive string.
print "Descriptive: " . $r->descriptive(); $r->descriptive("smtp");
This method gets and sets the OpenFrame::AbstractCookie object associated with this request.
my $cookietin = $r->cookies(); $r->cookies($cookietin);
This method gets and sets the argument hash reference associated with this request.
my $args = $r->arguments(); $r->arguments({colour => "blue"});
James Duncan <jduncan@fotango.com>
To install OpenFrame, copy and paste the appropriate command in to your terminal.
cpanm
cpanm OpenFrame
CPAN shell
perl -MCPAN -e shell install OpenFrame
For more information on module installation, please visit the detailed CPAN module installation guide.