[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [users@httpd] Re: what is perl 's syntax





Philip M. Gollucci wrote:
see perldoc -f print for why
also see perldoc CGI


#!/usr/bin/perl -wT

use strict;
use CGI qw (:standard);

print header();
print start_html();
print "This is an exmaple CGI script.\n";

foreach (param()) {
  print "<p>\n";
  print "$_ has value(s) => ";
  print param($_);
  print "</p>\n";
}

print end_html();


Same thing, only show "This is an example CGI script."

I keep doubt it is my httpd and perl module did not configure well

any opinion?


#!/usr/bin/perl    -wT

use strict;
use CGI ':standard';
use CGI qw(:standard);

my @param=param();

print "Content-type: text/html\n\n";
print "<html><body>\n";
print "This is an example CGI script.\n";

foreach my $name (param()) {
  my @value = param($name);
  print "<p>The field with the NAME attriabute equal to <b>
  $name</b> had a VALUE equal to <b>@value</b></p>\n";
  }
print "</body></html>";


On Sat, 2002-12-14 at 10:22, eric lin wrote:

Dave Sherohman wrote:

On Fri, Dec 13, 2002 at 01:02:10PM -0500, David Z Maze wrote:


foreach my $name (param()) {
 my @value = param($name);

Are you sure you don't mean $value here?


Not necessarily.  param() returns the first value associated with the
name whan called in scalar context or a list of all values associated
with the name in list context.



 print "<p>The field with the NAME attriabute equal to <b>
 $name</b> had a VALUE equal to <b>@value</b></p>\n";

...and here?  I'd probably change this loop to something like

foreach my $name (@param) {
  print "$name: " . param($name) . "\n";
}


foreach my $name (@param) {
 print "$name: " . join ', ', param($name) . "\n";
}


I tried yours , still not work well(only the Thisis cgi be shown in my browser) are you guy prety sure it is not httpd's config have problem but my script program not good enough? (like perl module loading or config?)
------------------------------------------------------------------------

fsshl@www:~$ cat /usr/lib/cgi-bin/entrance.cgi
#!/usr/bin/perl    -wT
use strict;
use CGI ':standard';
use CGI qw(:standard);

my @param=param();

print "Content-type: text/html\n\n";
print "<html><body>\n";
print "This is an example CGI script.\n";

foreach my $name (param()) {
  my @value = param($name);
  print "<p>The field with the NAME attriabute equal to <b>
  $name</b> had a VALUE equal to <b>@value</b></p>\n";
  }
print "</body></html>";



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org





--
Sincere Eric
www.linuxspice.com
linux pc for sale



Reply to: