1#!perl 2 3use strict; 4use warnings; 5 6use Test::More; 7Test::More->builder->no_ending( 1 ); 8use Config; 9use File::Spec; 10use CGI::Simple; 11 12$| = 1; 13 14plan skip_all => "fork not available on this platform" 15 unless $Config{d_fork}; 16 17eval { require HTTP::Request::Common; }; 18 19plan skip_all => 'HTTP::Request::Common not available' if $@; 20 21plan tests => 1; 22 23my $req = HTTP::Request::Common::POST( 24 '/dummy_location', 25 Content_Type => 'form-data', 26 Content => [ 27 test_file => 28 [ File::Spec->catfile( split /\//, "t/test_file.txt" ) ], 29 ] 30); 31 32# Useful in simulating an upload. 33$ENV{REQUEST_METHOD} = 'POST'; 34$ENV{CONTENT_TYPE} = 'multipart/form-data'; 35$ENV{CONTENT_LENGTH} = $req->content_length; 36 37if ( open( CHILD, "|-" ) ) { 38 print CHILD $req->content; 39 close CHILD; 40 exit 0; 41} 42 43my $q = CGI::Simple->new; 44is( $q->cgi_error, undef, "CGI::Simple can handle this" ); 45 46