Baldrick::Response

From CunningPlans

Jump to: navigation, search

Contents

[edit] package Baldrick::Response

Baldrick::Response is used to send output, including web page content and HTTP cookies, to the user.

[edit] Usage

A Response object is automatically created by Baldrick::App or Baldrick::Trousers at the beginning of handling each request. This Response object is passed to the Baldrick::Dogsbody constructor.

[edit] Obtaining the Response object

  • in your Dogsbody subclass: my $rsp = $self->getResponse();
  • anywhere you have the Baldrick::Request: my $rsp = $request->getResponse();
  • with the name response, it is one of the Standard Template Objects: [% response %]

[edit] Interface

[edit] new()

sub new() 
inherited from Baldrick::Turnip. Calls init() immediately with same args. If there are no args, init() will not be called - use force_init => 1 to get around this.
sub init(%args) 
called from constructor (Baldrick::Turnip::new), or by factory method if constructors not in use.
  • required parameters:
    • request => Baldrick::Request object
  • optional parameters:
    • mode => 'cgi' or 'apache'
    • request => Baldrick::Request
    • printer => null, or an object that implements print(), like Apache2::RequestRec
sub finish # ()

(this section is incomplete)

[edit] History

Baldrick::Response was added in Baldrick 0.85, with functions taken from Baldrick::Response and Baldrick::Dogsbody.

Personal tools