httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philip M. Gollucci" <phi...@p6m7g8.com>
Subject Re: [users@httpd] Re: what is perl 's syntax
Date Fri, 13 Dec 2002 21:27:23 GMT
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();


#!/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


Mime
View raw message