File: arbitrary_handles.t

package info (click to toggle)
libcgi-pm-perl 4.68-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,028 kB
  • sloc: perl: 6,082; makefile: 9
file content (30 lines) | stat: -rw-r--r-- 620 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!perl

use strict;
use warnings;

use Test::More tests => 4;
use IO::File;
use CGI;

my $test_string = 'game=soccer&game=baseball&weather=nice';
my $handle = IO::File->new_tmpfile;
$handle->write( $test_string );
$handle->flush;
$handle->seek( 0,0 );

{
	local $ENV{REQUEST_METHOD} = 'POST';

	ok( my $q = CGI->new( $handle ),"CGI->new from POST" );
	is( $q->param( 'weather' ),'nice', "param() from POST with IO::File" );
}

$handle->seek( 0,0 );

{
	local $ENV{REQUEST_METHOD} = 'GET';

	ok( my $q = CGI->new( $handle ),"CGI->new from GET" );
	is( $q->param( 'weather' ),'nice', "param() from GET with IO::File" );
}