CGI-Tiny

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN


    file

      File::Temp object storing the file contents in a temporary file,
      which will be cleaned up when the CGI script ends by default. The
      filehandle will be open with the seek pointer at the start of the
      file for reading.

  upload_names

      my $arrayref = $cgi->upload_names;

    Retrieve multipart/form-data file upload names, decoded to Unicode
    characters, as an ordered array reference, without duplication.

    NOTE: This will read the text form fields into memory as in "uploads".

  upload

      my $upload = $cgi->upload('foo');

    Retrieve a named multipart/form-data file upload. If the upload name
    was passed multiple times, returns the last value. Use "upload_array"
    to get multiple uploads with the same name.

    See "uploads" for details on the representation of the upload.

    NOTE: This will read the text form fields into memory as in "uploads".

  upload_array

      my $arrayref = $cgi->upload_array('foo');

    Retrieve all multipart/form-data file uploads of the specified name as
    an ordered array reference.

    See "uploads" for details on the representation of the uploads.

    NOTE: This will read the text form fields into memory as in "uploads".

 Response

  set_nph

      $cgi = $cgi->set_nph;
      $cgi = $cgi->set_nph(1);

    If set to a true value or called without a value before rendering
    response headers, CGI::Tiny will act as a NPH (Non-Parsed Header)
    <https://tools.ietf.org/html/rfc3875#section-5> script and render full
    HTTP response headers. This may be required for some CGI servers, or
    enable unbuffered responses or HTTP extensions not supported by the CGI
    server.

    No effect after response headers have been rendered.

  set_response_body_buffer

      $cgi = $cgi->set_response_body_buffer(128*1024);

    Sets the buffer size (number of bytes to read at once) for streaming a
    file or handle response body with "render" or "render_chunk". Defaults
    to the value of the CGI_TINY_RESPONSE_BODY_BUFFER environment variable
    or 131072 (128 KiB). A value of 0 will use the default value.

  set_response_status

      $cgi = $cgi->set_response_status(404);
      $cgi = $cgi->set_response_status('500 Internal Server Error');

    Sets the response HTTP status code. A full status string including a
    human-readable message will be used as-is. A bare status code must be a
    known HTTP status code
    <https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml>
    and will have the standard human-readable message appended.

    No effect after response headers have been rendered.

    The CGI protocol assumes a status of 200 OK if no response status is
    set.

  set_response_disposition

      $cgi = $cgi->set_response_disposition('attachment');
      $cgi = $cgi->set_response_disposition(attachment => $filename);
      $cgi = $cgi->set_response_disposition('inline'); # default behavior
      $cgi = $cgi->set_response_disposition(inline => $filename);

    Sets the response Content-Disposition header to indicate how the client
    should present the response, with an optional filename specified in
    Unicode characters. attachment suggests to download the content as a
    file, and inline suggests to display the content inline (the default
    behavior). No effect after response headers have been rendered.

  set_response_type

      $cgi = $cgi->set_response_type('application/xml');

    Sets the response Content-Type header, to override autodetection in
    "render" or "render_chunk". undef will remove the override. No effect
    after response headers have been rendered.

  set_response_charset

      $cgi = $cgi->set_response_charset('UTF-8');

    Set charset to use when rendering text, html, or xml response content,
    defaults to UTF-8.

  add_response_header

      $cgi = $cgi->add_response_header('Content-Language' => 'en');

    Adds a custom response header. No effect after response headers have
    been rendered.

    NOTE: Header names are case insensitive and CGI::Tiny does not attempt
    to deduplicate or munge headers that have been added manually. Headers
    are printed in the response in the same order added, and adding the
    same header multiple times will result in multiple instances of that
    response header.



( run in 1.461 second using v1.01-cache-2.11-cpan-39bf76dae61 )