[17175] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4587 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 11 18:11:44 2000

Date: Wed, 11 Oct 2000 15:10:27 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <971302227-v9-i4587@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 11 Oct 2000     Volume: 9 Number: 4587

Today's topics:
        How to know EMail  address of user <pliev@cityline.ru>
        How to know EMail  address of user <pliev@cityline.ru>
    Re: How to know EMail  address of user <hartleh1@westat.com>
    Re: How to know EMail  address of user (Chris Fedde)
    Re: How to know EMail  address of user (Craig Berry)
    Re: How to know EMail  address of user (brian d foy)
    Re: How to Print the Next Line Following a Pattern <tim@ipac.caltech.edu>
        How to read EMail  address of user(CGI) <pliev@cityline.ru>
        How to read EMail  address of user(CGI) <pliev@cityline.ru>
    Re: How to read EMail  address of user(CGI) (brian d foy)
    Re: How to read EMail  address of user(CGI) (David Wall)
        I can't get .pm files to work!!! help please! prashantsolomon@msn.com
        ip under win9x/2k from the commandline? <zakazan@gmx.de>
    Re: Is perl object oriented? (Craig Berry)
    Re: Keeping data structures private. <tim@ipac.caltech.edu>
        linux <nospam-crow@worc.com>
    Re: Making this match better (que. about regexp and arr <lr@hpl.hp.com>
        Newbie Pattern Match Question andreas_berg_genient@my-deja.com
        Object or BEGIN problem? (BUCK NAKED1)
    Re: Object or BEGIN problem? (Mark-Jason Dominus)
    Re: passing info with POST <flavell@mail.cern.ch>
    Re: passing info with POST (Mark-Jason Dominus)
    Re: passing info with POST <christopher_j@uswest.net>
    Re: passing info with POST (brian d foy)
    Re: passing info with POST (brian d foy)
    Re: passing info with POST (Mark-Jason Dominus)
    Re: passing info with POST (Chris Fedde)
    Re: pattern matching help ( ~s/// ) <lr@hpl.hp.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 11 Oct 2000 22:55:57 +0400
From: "Pliev" <pliev@cityline.ru>
Subject: How to know EMail  address of user
Message-Id: <971290183.193125@mao.cityline.ru>

How to know EMail  address
Hello!
I have web-site and am creating scripts for it.
Tell me please, how I can to know,using CGI,  the E-Mail address of user,
which has come to my  page?
On my page is form, which must send users's text on my E-mail. May be I must
to analyse %ENV ?
Or to use JavaScript?
Help me, please!
And, if You can, give me a little example...
Thanks!




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

Date: Wed, 11 Oct 2000 22:56:57 +0400
From: "Pliev" <pliev@cityline.ru>
Subject: How to know EMail  address of user
Message-Id: <971290243.795398@mao.cityline.ru>

Hello!
I have web-site and am creating scripts for it.
Tell me please, how I can to know,using CGI,  the E-Mail address of user,
which has come to my  page?
On my page is form, which must send users's text on my E-mail. May be I must
to analyse %ENV ?
Or to use JavaScript?
Help me, please!
And, if You can, give me a little example...
Thanks!




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

Date: Wed, 11 Oct 2000 15:24:54 -0400
From: hartley_h <hartleh1@westat.com>
Subject: Re: How to know EMail  address of user
Message-Id: <39E4BE86.CA1D3EFD@westat.com>

Pliev wrote:
> 
> Hello!
> I have web-site and am creating scripts for it.
> Tell me please, how I can to know,using CGI, the
> E-Mail address of user, which has come to my page?
> On my page is form, which must send users's text
> on my E-mail. May be I must to analyse %ENV?
> Or to use JavaScript?

Well, you should start with the documentation.  
See:

perldoc -q "mail address"

and see what that has to say.  That's not to say
you'll like the answer but that's what we have.

-- 
Henry Hartley


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

Date: Wed, 11 Oct 2000 21:23:31 GMT
From: cfedde@u.i.sl3d.com (Chris Fedde)
Subject: Re: How to know EMail  address of user
Message-Id: <nT4F5.18$T3.170882560@news.frii.net>

In article <971290243.795398@mao.cityline.ru>, Pliev <pliev@cityline.ru> wrote:
>Hello!
>I have web-site and am creating scripts for it.
>Tell me please, how I can to know,using CGI,  the E-Mail address of user,
>which has come to my  page?
>On my page is form, which must send users's text on my E-mail. May be I must
>to analyse %ENV ?
>Or to use JavaScript?
>Help me, please!
>And, if You can, give me a little example...
>Thanks!
>

Once apon a time there was a part of the CGI spec that made the
users e-mail address available to a CGI script.  That was so badly
abused that it has mostly gone away.  The best thing is to request the users
e-mail address in the form.  The problem with that is that many users have
trouble getting their own address right.  Validating an address then is
another question.   You also should read the section in perlfaq9 titled 
"How do I check a valid mail address?"


good luck
chris
-- 
    This space intentionally left blank


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

Date: Wed, 11 Oct 2000 21:48:17 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: How to know EMail  address of user
Message-Id: <su9o115la10d7c@corp.supernews.com>

Pliev (pliev@cityline.ru) wrote:
: I have web-site and am creating scripts for it.
: Tell me please, how I can to know,using CGI,  the E-Mail address of user,
: which has come to my  page?
: On my page is form, which must send users's text on my E-mail.

That's the only way.  Most user agents don't send the user's email address
automatically.  But note that even if the user 'must' fill in a text field
with an email address, there's no way to guarantee that it's really their
address (in one shot, that is, without going through complex multi-
exchange verification).

: May be I must
: to analyse %ENV ?
: Or to use JavaScript?

If you're asking how to get form data sent to the program, I suggest using
CGI.pm.  See the param() method.

-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "Quidquid latine dictum sit, altum viditur."
   |


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

Date: Wed, 11 Oct 2000 17:57:09 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: How to know EMail  address of user
Message-Id: <brian-ya02408000R1110001757090001@news.panix.com>

In article <nT4F5.18$T3.170882560@news.frii.net>, cfedde@u.i.sl3d.com (Chris Fedde) posted:

> Once apon a time there was a part of the CGI spec that made the
> users e-mail address available to a CGI script.  

are you sure?  i've never seen that as part of a specification.  it
has only been due to user-agent bugs AFAIK.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>


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

Date: Wed, 11 Oct 2000 12:42:22 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: How to Print the Next Line Following a Pattern
Message-Id: <39E4C29E.BFA9120E@ipac.caltech.edu>

"Luck E. Q." wrote:
> 
> How do I print the next line (or row) following a successful match in a
> pattern search?

while(<FILE>) {
  next if ! /$match/;
  die "Premature EOF\n" if ! defined ($_=<FILE>);
  print;
}

--

-- Tim Conrow         tim@ipac.caltech.edu                           |


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

Date: Thu, 12 Oct 2000 00:23:01 +0400
From: "Pliev" <pliev@cityline.ru>
Subject: How to read EMail  address of user(CGI)
Message-Id: <971295369.931271@mao.cityline.ru>

Hello!
I have web-site and am creating scripts for it.
Tell me please, how I can to know,using CGI,  the E-Mail address of user,
which has come to my  page?
On my page is form, which must send users's text on my E-mail. May be I must
to analyse %ENV ?
Or to use JavaScript?
Help me, please!
And, if You can, give me a little example...
Thanks!




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

Date: Thu, 12 Oct 2000 00:29:03 +0400
From: Cityline <pliev@cityline.ru>
Subject: How to read EMail  address of user(CGI)
Message-Id: <39E4CD8E.D3E873A5@cityline.ru>

Hello!
I have web-site and am creating scripts for it.
Tell me please, how I can to know,using CGI,  the E-Mail address of
user, which has come to my  page?
On my page is form, which must send users's text on my E-mail. May be I
must to analyse %ENV ?
Or to use JavaScript?
Help me, please!
And, if You can, give me a little example...
Thanks!



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

Date: Wed, 11 Oct 2000 16:25:53 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: How to read EMail  address of user(CGI)
Message-Id: <brian-ya02408000R1110001625530001@news.panix.com>

In article <971295369.931271@mao.cityline.ru>, "Pliev" <pliev@cityline.ru> posted:

> I have web-site and am creating scripts for it.
> Tell me please, how I can to know,using CGI,  the E-Mail address of user,
> which has come to my  page?

Please enter your email address: <INPUT TYPE="TEXT" NAME="email">

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>


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

Date: 11 Oct 2000 17:09:48 -0400
From: darkon@one.net (David Wall)
Subject: Re: How to read EMail  address of user(CGI)
Message-Id: <8FCAA5BB9darkononenet@206.112.192.118>

pliev@cityline.ru (Pliev) wrote in <971295369.931271@mao.cityline.ru>:

>Hello!
>I have web-site and am creating scripts for it.
>Tell me please, how I can to know,using CGI,  the E-Mail address of
>user, which has come to my  page?
>On my page is form, which must send users's text on my E-mail. May be I
>must to analyse %ENV ?
>Or to use JavaScript?
>Help me, please!
>And, if You can, give me a little example...
>Thanks!

You can't, unless the user voluntarily tells you.  This is a CGI question, 
anyway, so see the CGI FAQ, which has an answer to your question at 
http://www.htmlhelp.com/faq/cgifaq.3.html#2.  (You probably won't like it, 
though)

Followups set to comp.infosystems.www.authoring.cgi.

-- 
David Wall
darkon@one.net


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

Date: Wed, 11 Oct 2000 21:53:38 GMT
From: prashantsolomon@msn.com
Subject: I can't get .pm files to work!!! help please!
Message-Id: <8s2ngv$1fv$1@nnrp1.deja.com>

Hi there.

I am trying to create a Guestbook using an example in my PERL book.

The program calls for the creation of a .pm header file. However,
whenever I try to run the program, it shows a download box and asks if
I want to download the file.

I have created an entry for .pm extension in the regedit program and
also have associated the .pm extension with perl.exe.

I am using WINDOWS 98 with Microsoft PWS.

Please help!


Thanks

Prashant


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 11 Oct 2000 20:45:38 +0200
From: "Werner, Wolfgang" <zakazan@gmx.de>
Subject: ip under win9x/2k from the commandline?
Message-Id: <39E4B552.F4862627@gmx.de>

hi,
how can i find ount my ip using the windows commandline and perl?
thanks in advance!



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

Date: Wed, 11 Oct 2000 21:15:34 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Is perl object oriented?
Message-Id: <su9m3mq51vli4b@corp.supernews.com>

Mark (mark@mediamasters.net) wrote:
: Is perl a object oriented language?
: 
: and
: 
: What is an object oriented language?

I'd suggest asking those in the opposite order, as the answer to the first
will be meaningless without the answer to the second.

-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "Quidquid latine dictum sit, altum viditur."
   |


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

Date: Wed, 11 Oct 2000 12:25:11 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: Keeping data structures private.
Message-Id: <39E4BE97.F1F2A1B6@ipac.caltech.edu>

13_hellfish@my-deja.com wrote:
> 
> How do I keep a data structure private?  I need to access both a hash
> and an array in a subroutine.  So, I'm passing references to the
> subroutine via \.
> 
> Now in the subroute, It's easy to to get at the data, with @$, but I
> would like this data read only.  I'm not yet so great of a coder and
> would like this extra protection.

There's a pragma module called "readonly" on CPAN, but it says it works only on
scalars.

How 'bout just making copies and passing references to those?

--

-- Tim Conrow         tim@ipac.caltech.edu                           |


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

Date: Wed, 11 Oct 2000 23:58:54 +0200
From: "crow" <nospam-crow@worc.com>
Subject: linux
Message-Id: <newscache$4lba2g$cc7$1@news.freegates.be>

http://linuxfreak.nl/lol/lnxpics-more.php
hierdoor ben ik pas echt in linux gaan geloven...

--
================================================
Sven Braem
Ektros v.z.w.
http://www.ektros.com
================================================




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

Date: Wed, 11 Oct 2000 14:22:03 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Making this match better (que. about regexp and arrayhandling).
Message-Id: <MPG.144e79d699c00e4498ae28@nntp.hpl.hp.com>

In article <39E41819.29EA3326@ostas.lu.se> on Wed, 11 Oct 2000 09:35:02 
+0200, Jimmy Lantz <webmaster@ostas.lu.se> says...

 ...

> I have the following (see below) if-statement which checks about 3000
> lines of text,
> i really dont need to check the whole line only the first part (ie.
> until the first :) but I havent managed to  construct a regexp better
> then checking the whole line.
> Would I gain a lot of time if I manage to check only the first part
> instead of the whole line ?

Perhaps.  You can try benchmarking the code below, with or without the 
substr operation.

> if ($line =~ /$hex/)

???

> Below theres an foreach statement within an foreach statement, there
> must be a way to make this better ?

Yes, as is often the case.  Replace one of the loops by a hash lookup.

> NB! This match needs to be (and are) capable of handling more then one match.
> ############ Example of lines ###########
Reproduced below.


#!/usr/bin/perl -w
use strict;

my $hex = 'C2A5B8DF';
my %hex;
@hex{$hex =~ /..../g} = ();
my @hits;

while (my $line = <DATA>) {

# This pushes lines with multiple matches multiple times,
#   as in the posted code.

    push @hits, ($line) x grep exists $hex{$_} =>
        substr($line, 0, index $line, ':') =~ /..../g;

# This pushes lines with multiple matches once only,
#   which is more efficient.

#   for (substr($line, 0, index $line, ':') =~ /..../g) {
#       next unless exists $hex{$_};
#       push @hits, $line;
#       last;
#   }

}

print @hits;
__END__
B8DFC2A5B4F3:hdhfhhdhfdg:jfdjhfyyrettttr
B8DFC2A5:hdhfhhdhfdg:jfdjhfyyrettttr
B8DF:hdhfhhdhfdg:jfdjhfyyrettttr
C2A5B4F3CFC3:hdhfhhdhfdg:jfdjhfyyrettttr
B4F3CFC3:hdhfhhdhfdg:jfdjhfyyrettttr
CFC3:hdhfhhdhfdg:jfdjhfyyrettttr
B8DFB4F3CFC3:hdhfhhdhfdg:jfdjhfyyrettttr
B8DFC2A5CFC3:hdhfhhdhfdg:jfdjhfyyrettttr
B4F3CFC3:hdhfhhdhfdg:jfdjhfyyrettttr

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 11 Oct 2000 18:45:45 GMT
From: andreas_berg_genient@my-deja.com
Subject: Newbie Pattern Match Question
Message-Id: <8s2cgo$nht$1@nnrp1.deja.com>



Hi,

I somehow cannot get the right pattern to match
the following text. Suppose I have an HTML file:

<table width="100">

<table width="50">
<tr><td>Some unknown text</td></tr>
<tr><td>Some unknown text</td></tr>
</table>

<table width="50">
<tr><td>Some unknown text</td></tr>
<tr><td>Some specific text</td></tr>
<tr><td>Some unknown text</td></tr>
</table>

<table width="50">
<tr><td>Some unknown text</td></tr>
<tr><td>Some unknown text</td></tr>
<tr><td>Some unknown text</td></tr>
</table>

</table>

Now I want to match the part:

<table width="50">
<tr><td>Some unknown text</td></tr>
<tr><td>Some specific text</td></tr>
<tr><td>Some unknown text</td></tr>
</table>

I tried the pattern

<table(?:[\d\D]*?)Some specific text(?:[\d\D]*?)
</table>

but it matches the whole part from the beginning

<table width="100">

<table width="50">
<tr><td>Some unknown text</td></tr>
<tr><td>Some unknown text</td></tr>
<tr><td>Some unknown text</td></tr>
</table>

<table width="50">
<tr><td>Some unknown text</td></tr>
<tr><td>Some specific text</td></tr>
<tr><td>Some unknown text</td></tr>
</table>

So how can I make sure that it's taking
the "<table" that is closest to "Some specific
text"? I tried using a non matching pattern
like "(?!<table)" instead of the "\d\D" stuff,
but couldn't figure out how to use it.

Thanks for your help in advance,

Andreas.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 11 Oct 2000 16:27:48 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Object or BEGIN problem?
Message-Id: <15246-39E4DB54-47@storefull-244.iap.bryant.webtv.net>

pass me passme

What am I doing wrong in this script?

#!/usr/local/bin/perl -w 
print "Content-type: text/html";
print "\n\n";
print "File Has Been Un-Zipped";
$source = <FH, "tar.tar.gz">; 
use lib "./modules/Compress-Zlib-1.08";
use Zlib;
$dest = Zlib->new();
$dest = uncompress($source);


Gives this error.........

Can't locate loadable object for module Compress::Zlib in @INC (@INC
contains: ./modules/Compress-Zlib-1.08
/usr/local/lib/perl5/i386-bsdos/5.00404 /usr/local/lib/perl5
/usr/local/lib/perl5/site_perl/i386-bsdos /usr/local/lib/perl5/site_perl
) at untar2.pl line 7 BEGIN failed--compilation aborted at untar2.pl
line 7.

I have the module installed into a local directory at Hypermart. Is this
error code saying that it found the module, but that it just needs an
"object"? If so, how do I add an object. I've read all the docs about
objects and still don't understand them. 

Could someone please re-write the script above and add an object, so
that I can see how an object is done... or at least give me an easy
example of how to add an object to the above script? 

Thanks,
Dennis



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

Date: Wed, 11 Oct 2000 21:53:32 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: Object or BEGIN problem?
Message-Id: <39e4e15c.4e20$3a0@news.op.net>
Keywords: Allentown, Marlborough, egg, rhombohedral


In article <15246-39E4DB54-47@storefull-244.iap.bryant.webtv.net>,
BUCK NAKED1 <dennis100@webtv.net> wrote:
>What am I doing wrong in this script?
>$source = <FH, "tar.tar.gz">; 

This written in some language that resembles Perl, but is not actually Perl.
I don't know enough about Zlib to be able to tell you what to use instead.

>Can't locate loadable object for module Compress::Zlib in @INC (@INC
>contains: ./modules/Compress-Zlib-1.08

That means that Zlib has not been installed properly.  The compiled
code for the Zlib functions is in a file whose name probable ends in
".so".  It is called a 'shared object file'.  Perl searched for this
file and couldn't find it.

You might want to have a look at the 'perlfaq8' doc, which discusses
how to maintain a private library directory and how to install things
into it.

>I have the module installed into a local directory at Hypermart. Is this
>error code saying that it found the module, but that it just needs an
>"object"? If so, how do I add an object. I've read all the docs about
>objects and still don't understand them. 

The 'objects' in object-oriented programming that you read about are
not the same things as the object file that Perl needs to find.
They're irrelevant here.


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

Date: Wed, 11 Oct 2000 19:51:28 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: passing info with POST
Message-Id: <Pine.GHP.4.21.0010111945490.28061-100000@hpplus03.cern.ch>

On Wed, 11 Oct 2000, Paul Leduc wrote:

> I am trying to use the same CGI for several buttons in a form, by
> specifying different information for each call.. for example:
>     <form method="POST" action="/cgi-bin/sample.cgi?name=value1">
>     <form method="POST" action="/cgi-bin/sample.cgi?name=value2">

Check out a CGI tutorial somewhere.  This has nothing specifically to
do with Perl.

POST is not defined to use the query string as such.  CGI.pm will, in
practice, give you access to the query part of the URL for a POST
request, but this seems a pointlessly complicated way to handle your
requirement.

Just put a different hidden field into each form, and it will be
included along with the other parameters, as a completely normal and
supported part of the CGI specification.  Choose POST or GET according
to the usual criteria for CGI scripts.  Then everything is plain
sailing - well, that's my advice anyhow.



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

Date: Wed, 11 Oct 2000 18:17:50 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: passing info with POST
Message-Id: <39e4aecd.4650$1af@news.op.net>
Keywords: cutlet, gamma, insensible, oxalate

In article <39E4A5A8.918B6756@ca.ibm.com>,
Paul Leduc  <pleduc@ca.ibm.com> wrote:
>I am trying to use the same CGI for several buttons in a form, by
>specifying different information for each call.. for example:
>    <form method="POST" action="/cgi-bin/sample.cgi?name=value1">
>    <form method="POST" action="/cgi-bin/sample.cgi?name=value2">
>
>when I try to capture this information using the following, $myvalue is
>blank:
>    use CGI;
>    $q = new CGI;
>    $myvalue = $q->param('name');
>
>Should this work, or am I doing something wrong?

You are doing something wrong.  Data after the ? in the request URL is
called a 'query string'.  When you use the GET method, all the data is
passed in the query string.  When you use the POST method, the form
data is passed via a different channel, in the request content.

If the request URL for a POST form includes a quesry string, as yours
does, many browsers will send the data incorrectly.  Some won't send
the query string at all.  Some will send it with the rest of the form
via the reqest content.  You cannot depend on this.  (The standard is
quite clear on what *should* be done, but as usual the browser writers
have screwed it up.)

One thing you might try is:

        $q2 = new CGI ($q->query_string());
        $myvalue = $q2->param('name');

This *should* contain the value you are looking for.  But if the
browser botches the query and doesn't send the query string data,
there is obviously no way for Perl to help you get it.  Worse, it
might work with the brwsers that you use for testing and then fail
with the browser that your customer is using.

I strongly recommend that instead of this:

        <form method="POST" action="/cgi-bin/sample.cgi?name=value1">

you use this:

        <form method="POST" action="/cgi-bin/sample.cgi">
        <input type=hidden name="name" value="value1">
        ...


Most browsers seem able to get that right.




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

Date: Wed, 11 Oct 2000 11:28:54 -0700
From: "Christopher M. Jones" <christopher_j@uswest.net>
Subject: Re: passing info with POST
Message-Id: <qj2F5.512$505.195372@news.uswest.net>


"Paul Leduc" <pleduc@ca.ibm.com> wrote:
> I am trying to use the same CGI for several buttons in a form, by
> specifying different information for each call.. for example:
>     <form method="POST" action="/cgi-bin/sample.cgi?name=value1">
>     <form method="POST" action="/cgi-bin/sample.cgi?name=value2">

*sigh*

Well, there's yer problem right there.  Maybe, just maybe, you
might want to try something like this instead:

<form method="POST" action="/cgi-bin/sample.cgi">
<input type="hidden" name="name" value="value1">
 ...

>
> when I try to capture this information using the following, $myvalue is
> blank:
>     use CGI;
>     $q = new CGI;
>     $myvalue = $q->param('name');
>
> Should this work, or am I doing something wrong?

Yes you are, see above.


/me wanders off mumbling somethin' about youngin's not
learnin' their html properly these days.




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

Date: Wed, 11 Oct 2000 14:53:48 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: passing info with POST
Message-Id: <brian-ya02408000R1110001453480001@news.panix.com>

In article <Pine.GHP.4.21.0010111945490.28061-100000@hpplus03.cern.ch>, "Alan J. Flavell" <flavell@mail.cern.ch> posted:

> On Wed, 11 Oct 2000, Paul Leduc wrote:

> > I am trying to use the same CGI for several buttons in a form, by
> > specifying different information for each call.. for example:
> >     <form method="POST" action="/cgi-bin/sample.cgi?name=value1">
> >     <form method="POST" action="/cgi-bin/sample.cgi?name=value2">

> Check out a CGI tutorial somewhere.  This has nothing specifically to
> do with Perl.

i have to disagree.  to make this happen with CGI.pm, last time
i looked, you had to uncomment a line of code.  it's cleary documented
in the source around line 445 for version 2.56 (which came with Perl
5.6).

> POST is not defined to use the query string as such.  CGI.pm will, in
> practice, give you access to the query part of the URL for a POST
> request, but this seems a pointlessly complicated way to handle your
> requirement.

it's been useful to me for some things :)

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>


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

Date: Wed, 11 Oct 2000 14:55:14 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: passing info with POST
Message-Id: <brian-ya02408000R1110001455140001@news.panix.com>

In article <39e4aecd.4650$1af@news.op.net>, mjd@plover.com (Mark-Jason Dominus) posted:

> If the request URL for a POST form includes a quesry string, as yours
> does, many browsers will send the data incorrectly.  Some won't send
> the query string at all.  Some will send it with the rest of the form
> via the reqest content.  You cannot depend on this.  (The standard is
> quite clear on what *should* be done, but as usual the browser writers
> have screwed it up.)

is it clear?  i haven't seen anything that says message bodies and
query strings are mutually exclusive.  it's undefined behaviour.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>


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

Date: Wed, 11 Oct 2000 21:45:34 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: passing info with POST
Message-Id: <39e4df7d.4dde$116@news.op.net>
Keywords: Legendre, hack, homeland, molasses

In article <brian-ya02408000R1110001455140001@news.panix.com>,
brian d foy <brian@smithrenaud.com> wrote:
>In article <39e4aecd.4650$1af@news.op.net>, mjd@plover.com (Mark-Jason Dominus) posted:
>
>> If the request URL for a POST form includes a quesry string, as yours
>> does, many browsers will send the data incorrectly.  Some won't send
>> the query string at all.  Some will send it with the rest of the form
>> via the reqest content.  You cannot depend on this.  (The standard is
>> quite clear on what *should* be done, but as usual the browser writers
>> have screwed it up.)
>
>is it clear?

It's clear to me.  Section 17.13.3 of the W3C HTML 4.01 spec says:

     If the method is "post" and the action is an HTTP URI, the user
     agent conducts an HTTP "post" transaction using the value of the
     action attribute and a message created according to the content
     type specified by the enctype attribute.

        (http://www.w3.org/TR/html4/interact/forms.html)

There's nothing subtle or complicated here.  You take the action URI,
which is the URI specified in the ACTION attribute of the FORM tag
(Section 8.1.1), and that's the URI you use for the transaction.
There is nothing anywhere about truncatating the action URI at a
question mark, or moving data from the action URI into the message
body.  The message body is made of a form data set built from
'controls', which are created with INPUT elements and other elements.

This has not really changed since the 1995 HTML2.0 spec:

   To process a form whose action URL is an HTTP URL and whose method
   is `POST', the user agent conducts an HTTP POST transaction using
   the action URI, and a message body of type `application/x-www-form-
   urlencoded' format as above.

> it's undefined behaviour.

I believe you are mistaken.



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

Date: Wed, 11 Oct 2000 22:00:44 GMT
From: cfedde@u.i.sl3d.com (Chris Fedde)
Subject: Re: passing info with POST
Message-Id: <gq5F5.20$T3.170882560@news.frii.net>
Keywords: Legendre, hack, homeland, molasses

In article <39e4df7d.4dde$116@news.op.net>,
Mark-Jason Dominus <mjd@plover.com> wrote:
>In article <brian-ya02408000R1110001455140001@news.panix.com>,
>brian d foy <brian@smithrenaud.com> wrote:
>>In article <39e4aecd.4650$1af@news.op.net>, mjd@plover.com (Mark-Jason
>Dominus) posted:
>>
>
>> it's undefined behaviour.
>
>I believe you are mistaken.
>

I may have missed something obvious, and this thread is drifting furhter off
topic but...

It seems that the sections that bryan d foy quoted refer to the
behavior of the user agent, not to the behavior of the server.
Details of what the query string part of a URI means to the server
recieving a POST request are AFAIK undefined.  That leaves us with
the robustness princeple. Which is apparently what CGI.pm does.
-- 
    This space intentionally left blank


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

Date: Wed, 11 Oct 2000 12:09:50 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: pattern matching help ( ~s/// )
Message-Id: <MPG.144e5adab598137098ae26@nntp.hpl.hp.com>

In article <39E3BBA8.C014CD75@vpservices.com> on Tue, 10 Oct 2000 
18:00:24 -0700, Jeff Zucker <jeff@vpservices.com> says...

 ...

> 1. There is a problem with *forward* slashes in a regex: is is very hard
> to see what is going on because the forward slash is also the character
> used to delimit the parts of the regex.  So when a forward slash is part
> of the pattern it is better to use alternate delimiters (e.g. an
> apostrophe) so you can see what is going on.  These two are exactly the
> same (try it and see):
> 
>      s/a/b/;   s'a'b';

It is true that the two 'are exactly the same' in this specific case, 
but not in general, because of the specific choice of single-quotes as 
the alternate delimiters.

From perlop:

PATTERN may contain variables, which will be interpolated (and the 
pattern recompiled) every time the pattern search is evaluated, except 
for when the delimiter is a single quote. 

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 4587
**************************************


home help back first fref pref prev next nref lref last post