CGI::Test::Input::Custom - send custom data to CGIs for testing


CGI-Test-Input-Custom documentation  | view source Contained in the CGI-Test-Input-Custom distribution.

Index


NAME

Top

CGI::Test::Input::Custom - send custom data to CGIs for testing

SYNOPSIS

Top

  use CGI::Test;
  use CGI::Test::Input::Custom;

  my $ct = CGI::Test->new(...);

  my $input = CGI::Test::Input::Custom->new();

  $input->set_mime_type('text/xml', -encoding => 'utf8');

  $input->add_content(<<EOX);
  <?xml version="1.0" encoding="UTF-8"?>
  <FooBar>
    <Chanel>Whatever</Chanel>
    <Date>20080304231200</Date>
  </FooBar>
  EOX

  my $page = $ct->POST('http://www.foo.org/cgi/sendMeXML', $input);

DESCRIPTION

Top

This module allows to send custom data to CGIs on POST requests when using the CGI::Test framework.

API

These are the methods available:

CGI::Test::Input::Custom->new(%args)

creates a new input object.

The accepted arguments are as follows:

-mime_type => $mime_type

mime type of the content. Default is application/octect-stream.

-content => $data

data to send in the request

-content => $encoding

encoding to use when converting data from internal perl representation to on-the-wire format. Default is utf8.

See Encode.

$input->set_mime_type($mime_type);

sets the mime type

$input->add_content($data);

appends data to be sent to the CGI

SEE ALSO

Top

Test::CGI, Test::CGI::Input, Internet media types (aka MIME types) entry on the Wikipedia.

AUTHOR

Top

Salvador Fandiño, <sfandino@yahoo.com>

COPYRIGHT AND LICENSE

Top


CGI-Test-Input-Custom documentation  | view source Contained in the CGI-Test-Input-Custom distribution.