The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

CGI::Header::PSGI - Role for generating PSGI response headers

SYNOPSIS

  use parent 'CGI';
  use Role::Tiny::With;

  with 'CGI::Header::PSGI';

  sub crlf { $CGI::CRLF }

VERSION

This document refers to CGI::Header::PSGI 0.01.

DESCRIPTION

This module is a role to generate PSGI response headers.

REQUIRED METHODS

Your class has to implement the following methods.

$query->charset

Returns the character set sent to the browser.

$query->self_url
$query->cache
$query->no_cache (optional)
$query->crlf

Returns the system specific line ending sequence.

METHODS

By using this module, your class is capable of following methods.

($status_code, $headers_aref) = $query->psgi_header( %args )

Works like CGI.pm's header(), but the return format is modified. It returns an array with the status code and arrayref of header pairs that PSGI requires.

Unlike header(), this method doesn't update charset().

($status_code, $headers_aref) = $query->psgi_redirect( %args )

Works like CGI.pm's redirect(), but the return format is modified. It returns an array with the status code and arrayref of header pairs that PSGI requires.

SEE ALSO

CGI::PSGI, CGI::Emulate::PSGI, CGI::Simple

AUTHOR

Ryo Anazawa (anazawa@cpan.org)

LICENSE

This module is free software; you can redistibute it and/or modify it under the same terms as Perl itself. See perlartistic.