Hi,

I'd like to suggest a module that I came up with to test CGI file uploading logic. I have not found anything else like it.

If anyone has any thoughts on its usefulness or knows of something else that does a similar job, please let me know.

Thanks!
Simon

------------------------

NAME

CGI::Filehandle

SYNOPSIS

#Test code:

use CGI;
my $q = new CGI;
my $fh = CGI::Filehandle->new_tie('/tmp/apple.gif');
$q->param('file', $fh);

#...Set up other CGI parameters

***

#CGI processing code:

my $filename = $q->param('file');
#$filename now set to 'apple.gif'

my @lines;
push @lines, $_ while (<$filename>);
#$filename is also a filehandle,
#just like under live CGI.pm processing

DESCRIPTION

This module helps you test CGI file uploading logic if you have a way to invoke your CGI processing code outside of a web server. When CGI.pm handles a file upload, an invocation of CGI->param() returns a filehandle, but if it's called in scalar context, you receive the name of the uploaded file. CGI.pm uses a private class to do it, so CGI::Filehandle emulates this functionality.

This module relies on IO::WrapTie.

----------------------
--

Simon (Vsevolod ILyushchenko)   [EMAIL PROTECTED]
                                http://www.simonf.com

Terrorism is a tactic and so to declare war on terrorism
is equivalent to Roosevelt's declaring war on blitzkrieg.

Zbigniew Brzezinski, U.S. national security advisor, 1977-81

Reply via email to