Zahatski Aliaksandr > WebDAO-2.14 > WebDAO::Response

Download:
WebDAO-2.14.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  1
View/Report Bugs
Source  

NAME ^

WebDAO::Response - Response class

SYNOPSYS ^

        new WebDAO::Response:: cv => $cv

DESCRIPTION ^

Class for make HTTP response

METHODS ^

get_request

Return ref to request object (WebDAO::CV)

set_status INT

set response HTTP status

    $r->set_status(200)

return $self

set_header NAME, VALUE

Set out header:

        $response->set_header('Location', $redirect_url);
        $response->set_header( 'Content-Type' => 'text/html; charset=utf-8' );

return $self reference

get_header NAME

return value for header NAME:

aliases for headers

content_type

  $r->content_type('text/html; charset=utf-8');

content_length

A decimal number indicating the size in bytes of the message content.

get_mime_for_filename <filename>

Determine mime type for filename (Simple by ext); return str

print_header

print header.return $self reference

redirect2url <url for redirect to> [, $code]

Set headers for redirect to url.return $self reference

set_cookie ( name => <cookie_name>, value=><cookie_value> ...)

Set cookie. return $self reference

set_callback(sub1{}[, sub2{} ..])

Set callbacks for call after flush

send_file <filename>|<file_handle>|<reference to GLOB> [, -type=><MIME type string>]

Prepare headers and save

    $respose->send_file($filename, -type=>'image/jpeg');

flush

Flush current state of response.

set_modal

Set modal mode for answer

error404

Set HTTP 404 headers

wantformat ['format',['forse_set_format']]

Return expected output format: defauilt html

       # return string for format
       $r->wantformat()

Check if desired format is expected

  #$r->wantformat('html') return boolean
  if ($r->wantformat('html')) { 
      # 
  }

Force set desired format:

  $r->wantformat('html'=>1); #return $response object ref

detect_wantformat ($cv)

Method for detect output format when wantformat() called

Must return :

        string  - output format, i.e. 'html', 'xml'
        undef - unknown ( use defaults )

set_empty

Set flag for empty response. Headers are not printed. return $self

is_empty

Check is response cleared. Return 1|0

SEE ALSO ^

http://webdao.sourceforge.net

AUTHOR ^

Zahatski Aliaksandr, <zag@cpan.org>

COPYRIGHT AND LICENSE ^

Copyright 2002-2012 by Zahatski Aliaksandr

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: