--- "Bradshaw, Brian" <[EMAIL PROTECTED]> wrote:
> Ok. Just so we know.. I did not write this. It has been dumped on me to
> alter to work with a new set of content we are putting in.
>
> How do I find out if the cgi.pm module is installed. The people here that
> know are not available to me and this is all pretty new.
perl -MCGI -e 'print $CGI::VERSION'
That will not only tell you if you have CGI.pm installed, but what version number it
is, if
installed.
A quick and dirty fix to stuff values in the %FORM hash would be as follows:
use CGI qw/:standard/;
my %FORM = map { $_, @{ [ param( $_ ) ] } > 1 ? [ param( $_ ) ] : param( $_ ) }
param();
No, I don't recommend that, but it will accurately populate %FORM with the form data.
If there is
only one value for a form name, then the value for that particular hash element will
be a scalar.
If there is more than one value (e.g. a QUERY_STRING like "color=red;color=blue"),
then the hash
element's value will be a listref containing all values. This is less common and I
wouldn't worry
about it.
For the following query string:
color=red;color=blue;name=Ovid
You get the following data structure:
%FORM = (
'name' => 'Ovid',
'color' => [
'red',
'blue'
]
);
Cheers,
Curtis Poe
> Also, I'll check the links you sent, Curtis, but can the code I have be
> fixed if I don;t have this cgi.pm installed??
You should have CGI.pm installed as it is included in the Perl distribution.
> Thanks.
>
> -----Original Message-----
> From: Curtis Poe [mailto:[EMAIL PROTECTED]]
> Sent: Friday, August 24, 2001 3:54 PM
> To: Bradshaw, Brian; [EMAIL PROTECTED]
> Subject: Re: I can't figure out what this reads
>
>
> --- "Bradshaw, Brian" <[EMAIL PROTECTED]> wrote:
> > Hi Folks. I have run into a wall and would appreciate any assistance.
>
> Brian,
>
> With all due respect, the code you have below is a broken attempt to handle
> CGI form parsing.
> Rather than retype the concerns that I've typed many times before, I'll just
> point you to a few
> posts I've made covering code just like this:
>
> http://www.perlmonks.org/index.pl?node_id=77694
> http://www.perlmonks.org/index.pl?node_id=76315
> http://www.perlmonks.org/index.pl?node_id=51012
> http://www.easystreet.com/~ovid/cgi_course/lesson_two/lesson_two.html
>
> > REQUEST_METHOD: POST
>
> > Now, I am passing in the variables via a form with hidden fields but they
> > are not showing up in the QUERY_STRING.
>
> They shouldn't show up in QUERY_STRING. This is because you use the POST
> method. In this case,
> the data is sent in the body of the request issued by the user agent
> (browser).
>
> > STDIN reads the CONTENT_LENGTH, i can't figure out where it actually gets
> > data to perform the split on.
>
> STDIN doesn't read the content length. STDIN contains the data and
> CONTENT_LENGTH is the length
> of said data. They should match.
>
> As a side note, I noticed that you were populating some script-specific
> variables in your
> form-parsing code. That's not a good idea. Each section of code should do
> one thing and do it
> well. It should have *no* side effects, if possible. This is called
> 'orthogonal'. If code is
> orthogonal, it winds up being much easier to maintain. If a section of code
> is changing things
> all over the place and you need to patch up that section, you may need to
> find all of the other
> places where that code affects things. This quickly gets to be a pain.
> Having functions that
> don't access any globals, but instead rely on well-defined arguments that
> they receive and return
> is much, much easier to maintain.
>
> Cheers,
> Curtis Poe
>
> =====
> Senior Programmer
> Onsite! Technology (http://www.onsitetech.com/)
> "Ovid" on http://www.perlmonks.org/
>
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo! Messenger
> http://phonecard.yahoo.com/
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
=====
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
"Ovid" on http://www.perlmonks.org/
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]