The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

OpenFrame::Request - An abstract request class

SYNOPSIS

  use OpenFrame;
  my $uri = URI->new("http://localhost/");
  my $r = OpenFrame::Request->new(uri => $uri,
        originator => 'http://www.example.com/',
        descriptive => 'web',
        arguments => { colour => 'red' },
        cookies => OpenFrame::Cookietin->new());
  print "URI: " . $r->uri();
  print "Originator: " . $r->originator();
  print "Descriptive: " . $r->descriptive();
  my $args = $r->arguments();
  my $cookies = $r->cookies();

DESCRIPTION

OpenFrame::Request represents requests inside OpenFrame. Requests represent some kind of request for information given a URI.

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::Request, which is then used through OpenFrame.

METHODS

new()

The new() method creates a new OpenFrame::Request object. It takes a variety of parameters, of which only the "uri" parameter is mandatory.

The parameters are:

uri

The location this request is for. This must be a URI object.

originator

A string describing the originator of the request. Defaults to "GenericServer".

descriptive

A string describing the type of the request. Defaults to "web".

arguments

A hash reference which are the arguments passed along with the request.

cookies

An OpenFrame::Cookietin object which contains any cookies passed with the request.

  my $uri = URI->new("http://localhost/");
  my $r = OpenFrame::Request->new(uri => $uri,
        originator => 'secret agent',
        descriptive => 'web',
        arguments => { colour => 'red' },
        cookies => OpenFrame::Cookietin->new());

uri()

This method gets and sets the URI.

  print "URI: " . $r->uri();
  $r->uri(URI->new("http://foo.com/"));

originator()

This method gets and sets the originator string.

  print "Originator: " . $r->originator();
  $r->setOriginator("me");

descriptive()

This method gets and sets the descriptive string.

  print "Descriptive: " . $r->descriptive();
  $r->descriptive("smtp");

cookies()

This method gets and sets the OpenFrame::Cookietin object associated with this request.

  my $cookietin = $r->cookies();
  $r->cookies($cookietin);

arguments()

This method gets and sets the argument hash reference associated with this request.

  my $args = $r->arguments();
  $r->arguments({colour => "blue"});

AUTHOR

James Duncan <jduncan@fotango.com>