[Israel.pm] Survey: CGI.pm - like modules

Shlomi Fish shlomif at iglu.org.il
Wed Jun 9 07:33:37 PDT 2004


On Tuesday 08 June 2004 19:13, Gabor Szabo wrote:
> ps.
> 1. I'd also appreciate if some good soul would download the latest 1.07
> version and gave it a try.
> 2. I am very interested in how this thing would work (or fail) in mod_perl
> environment, something I have not checked at all.
>

Installed CGI::Upload version 1.08 from CPAN. All tests passed, but it 
reported that the CGI::Simple specific ones were skipped.

Tried it on Mandrakelinux 10.0 Official with:

* apache-1.3.29-1.1.100mdk
* apache-mod_perl-1.3.29_1.29-3.1.100mdk
* perl-5.8.3-5mdk

CGI.pm version 3.0x or later (should not make too much difference which).

The following script:

<<<
#!/usr/bin/perl -w

use strict;

use CGI;
use CGI::Upload;

my $q = CGI->new();
my $upload = CGI::Upload->new({ query => $q});

use constant FILE_PARAM => 'file';

print $q->header();

if ($q->param('sent'))
{
    my $file_name = $upload->file_name(FILE_PARAM);
    my $file_type = $upload->file_type(FILE_PARAM);
    my $file_handle = $upload->file_handle(FILE_PARAM);
    
    print "<html><body>\n";
    print "<p>Filename = " . CGI::escapeHTML($file_name) . "</p>\n";
    print "<p>Filetype = " . CGI::escapeHTML($file_type) . "</p>\n";
    my $content;
    {
        local $/;
        $content = <$file_handle>;
    }
    
    print "<p>content = " . CGI::escapeHTML($content) . "</p>\n";
    print "</body></html>\n";
}
else
{
    print <<"EOF";
<html>
<body>
<h1>Submit the form:</h1>
<form enctype="multipart/form-data" method="post">
<input type="hidden" name="sent" value="1" />
<p>
<input type="file" name="file" />
</p>
<p>
<input type="submit" value="Send" />
</p>
</form>
</body>
</html>
IF

}
>>>

Seems to work perfectly fine from what I tried. However, it is possible I 
discovered a bug in the default Mandrake Apache configuration due to this.

Regards,

	Shlomi Fish

>
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://www.perl.org.il/mailman/listinfo/perl

-- 

---------------------------------------------------------------------
Shlomi Fish      shlomif at iglu.org.il
Homepage:        http://shlomif.il.eu.org/

Quidquid latine dictum sit, altum viditur.
        [Whatever is said in Latin sounds profound.]



More information about the Perl mailing list