Hi,
I am trying to access the parameter list from a form. I keep getting
a "Not an ARRAY reference at (eval...)". The error seems to refer to
my @names = $q->param;
If I use Dump I get:
# imp
* list.txt
# dsc
* Groovey
*
# set
*
# usr
* DP
# job
* jobs/DP227
# go
* Y
# DUF
I think there is some odd characters or something after Groovey. The
form has a file upload button and I expect that this might be the
source of the problem. There is a file being uploaded when I am
getting the above error.
So I tried fetching all the parameters into a hash but I keep hitting
other problems; "can't use bareword Vars with strict" and the hash
reference looks empty.
What is the best way to slurp up the field values from a form?
How can I enable strict and use barewords like Vars?
What am I doing wrong with my hash reference ($q->Vars doesn't work
either)?
Below is a edited version, I have been trying some lots of variation
to get it to work but alas nada. All I want to do is slurp up the
text file being uploaded (not shown below), leave it in /tmp, then
forward the whole process to another program with all the original
field data intact.
Thanx in advance.
Dp.
==============
#!/usr/bin/perl -w
use strict;
use CGI qw\standard cgi-lib\;
use CGI::Carp qw(fatalsToBrowser);
$CGI::POST_MAX = 1024 * 1000; # Set limit to 1MB
my $q = new CGI;
my @names = $q->param;
my $params = Vars;
my $len = @{$params};
print $q->header(-type=>'text/html',
-charset=>'iso-8859-1',
);
print $q->start_html(
-BGCOLOR => '#777777',
-script =>{-language => 'JAVASCRIPT',
-src => 'http://austin/iptc.js'},
# -onLoad => "$jscript",
-style =>{-src=>'http://austin/css/iptc-
meta.css'},
);
print $q->h1("Greetings");
print "Ref is $len";
print $q->Dump;
print $q->start_form(-method => 'post',
-action => 'http://austin/cgi-bin/dwsrun?PXEXI.DWO',
-name => 'myform',
);
foreach my $p (@names) {
my $v = $q->param($p);
print $q->hidden(-name=>$p,
-default=>$v,
);
print "$p, "
}
print end_html;
=====================
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>