Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Apache2::Request doesn't work as expected

Reply
Thread Tools

Apache2::Request doesn't work as expected

 
 
kwan
Guest
Posts: n/a
 
      03-05-2010
Hello,

I wrote a mod_perl to check some of the value that users select. The
script will generate a form according to the selection from the user.
There are three forms that are dynamically generated according to the
selection,
in the "display form", there are links to the "add form" and
"modify form".
in the "add form", there are links to the "display form" and
modify form".
in the "modify form", there are links to the display form"
and "add from".

In each link, it is like this:
http://hostname:80/mainform?selection=display
http://hostname:80/mainform?selection=modify
http://hostname:80/mainform?selection=add

within the form, I also have the submit form for user to submit the
content to the server.
the submit form is: <input type="submit" name="selection"
value='Add Content'>

Before, when I use "use CGI" package I can use "param", and the form
will be generate and query according to the user submit.
Code:
my $selection = lc (param('selection'));
if ($selection eq "add content") { }# work with CGI, but
not with Apache2::Request:aram
elsif ($selection eq "modify") {} # work both
elsif ($selection eq "add") {} # work both
elsif ($selection eq "display"){} # work both
elsif ($selection eq "modify content"){} # work with CGI,
but not with Apache2::Requestaram

when using CGI, I can get the "param" work according to the user
selection. However, when I replace to the following code by using
Apache2::Request, when user select modify form, and submit the form.
the $r->param('selection') is failed to identify the "modify content"
value.

my $rq = new Apache2::Request($r);
my $selection = lc ($rq->param('selection'));

I've followed the perldoc Apache2::Request, it isn't much infor about
the
behavior of the Apache2::Request, as it is mimic the CGI.

Thank
 
Reply With Quote
 
 
 
 
smallpond
Guest
Posts: n/a
 
      03-06-2010
On Mar 5, 6:31*pm, kwan <kwan.ji...@gmail.com> wrote:
> Hello,
>
> I wrote a mod_perl to check some of the value that users select. The
> script will generate a form according to the selection from the user.
> There are three forms that are dynamically generated according to the
> selection,
> * * * * *in the "display form", there are links to the "add form" and
> "modify form".
> * * * * *in the "add form", there are links to the "display form" and
> modify form".
> * * * * *in the "modify form", there are links to the display form"
> and "add from".
>
> In each link, it is like this:
> * * * * * * * * * *http://hostname:80/mainform?selection=display
> * * * * * * * * * *http://hostname:80/mainform?selection=modify
> * * * * * * * * * *http://hostname:80/mainform?selection=add
>
> within the form, I also have the submit form for user to submit the
> content to the server.
> the submit form is: <input type="submit" name="selection"
> value='Add Content'>
>
> Before, when I use "use CGI" package I can use "param", and the form
> will be generate and query according to the user submit.
> Code:
> * * * * * my $selection = lc (param('selection'));
> * * * * * if ($selection eq "add content") { * *}# work with CGI, but
> not with Apache2::Request:aram
> * * * * * elsif ($selection eq "modify") {} *# work both
> * * * * * elsif ($selection eq "add") {} * * * # work both
> * * * * * elsif ($selection eq "display"){} * # work both
> * * * * * elsif ($selection eq "modify content"){} # work with CGI,
> but not with Apache2::Requestaram
>
> when using CGI, I can get the "param" work according to the user
> selection. However, when I replace *to the following code by using
> Apache2::Request, when user select modify form, and submit the form.
> the $r->param('selection') is failed to identify the "modify content"
> value.
>
> my $rq = new Apache2::Request($r);
> my $selection = lc ($rq->param('selection'));
>
> I've followed the perldoc Apache2::Request, it isn't much infor about
> the
> behavior of the Apache2::Request, as it is mimic the CGI.
>



Single quotes are not used in html. It should be:
<input type="submit" name="selection" value="Add Content">

Spaces are excluded by HTTP. It should be encoded as
"Add%20Content" in the URL. You can print the params to see
what you are getting.
 
Reply With Quote
 
 
 
 
John Bokma
Guest
Posts: n/a
 
      03-06-2010
smallpond <> writes:

> Single quotes are not used in html. It should be:
> <input type="submit" name="selection" value="Add Content">


Not true

--
John Bokma j3b

Hacking & Hiking in Mexico - http://johnbokma.com/
http://castleamber.com/ - Perl & Python Development
 
Reply With Quote
 
kwan
Guest
Posts: n/a
 
      03-06-2010
On Mar 6, 11:59*am, smallpond <smallp...@juno.com> wrote:
> On Mar 5, 6:31*pm, kwan <kwan.ji...@gmail.com> wrote:
>
>
>
> > Hello,

>
> > I wrote a mod_perl to check some of the value that users select. The
> > script will generate a form according to the selection from the user.
> > There are three forms that are dynamically generated according to the
> > selection,
> > * * * * *in the "display form", there are links to the "add form" and
> > "modify form".
> > * * * * *in the "add form", there are links to the "display form" and
> > modify form".
> > * * * * *in the "modify form", there are links to the displayform"
> > and "add from".

>
> > In each link, it is like this:
> > * * * * * * * * * *http://hostname:80/mainform?selection=display
> > * * * * * * * * * *http://hostname:80/mainform?selection=modify
> > * * * * * * * * * *http://hostname:80/mainform?selection=add

>
> > within the form, I also have the submit form for user to submit the
> > content to the server.
> > the submit form is: <input type="submit" name="selection"
> > value='Add Content'>

>
> > Before, when I use "use CGI" package I can use "param", and the form
> > will be generate and query according to the user submit.
> > Code:
> > * * * * * my $selection = lc (param('selection'));
> > * * * * * if ($selection eq "add content") { * *}# work with CGI, but
> > not with Apache2::Request:aram
> > * * * * * elsif ($selection eq "modify") {} *# work both
> > * * * * * elsif ($selection eq "add") {} * * * # work both
> > * * * * * elsif ($selection eq "display"){} * # work both
> > * * * * * elsif ($selection eq "modify content"){} # work with CGI,
> > but not with Apache2::Requestaram

>
> > when using CGI, I can get the "param" work according to the user
> > selection. However, when I replace *to the following code by using
> > Apache2::Request, when user select modify form, and submit the form.
> > the $r->param('selection') is failed to identify the "modify content"
> > value.

>
> > my $rq = new Apache2::Request($r);
> > my $selection = lc ($rq->param('selection'));

>
> > I've followed the perldoc Apache2::Request, it isn't much infor about
> > the
> > behavior of the Apache2::Request, as it is mimic the CGI.

>
> Single quotes are not used in html. *It should be:
> <input type="submit" name="selection" value="Add Content">
>
> Spaces are excluded by HTTP. *It should be encoded as
> "Add%20Content" in the URL. *You can print the params to see
> what you are getting.


It doesn't related with that.
 
Reply With Quote
 
sln@netherlands.com
Guest
Posts: n/a
 
      03-07-2010
On Sat, 6 Mar 2010 09:59:11 -0800 (PST), smallpond <> wrote:

>Single quotes are not used in html. It should be:

I could care less.

>Spaces are excluded by HTTP. It should be encoded as

I don't know web stuff, just html. Does http exclude spaces?

-sln
 
Reply With Quote
 
sln@netherlands.com
Guest
Posts: n/a
 
      03-07-2010
On Sat, 06 Mar 2010 19:46:05 -0600, Tad McClellan <> wrote:

>smallpond <> wrote:
>
>
>> Single quotes are not used in html.

>
>
>Single quotes are most certainly allowed in HTML.
>
>
> http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2

^^
So xml is a fix on html and '' is grandfathered in.

>
> By default, SGML requires that all attribute values be delimited
> using either double quotation marks (ASCII decimal 34) or single
> quotation marks (ASCII decimal 39).


And now, the king god SGML speaks it, deems it, it!
It is now in stone, and let no man take us'eth er a under.
So beith, as it was and will be, <pause>, or forever hold your peace.. <pause>,
Amen!

So sayeth we all !! Aye...

-sln
 
Reply With Quote
 
kwan
Guest
Posts: n/a
 
      03-07-2010
On Mar 6, 9:23*pm, s...@netherlands.com wrote:
> On Sat, 06 Mar 2010 19:46:05 -0600, Tad McClellan <ta...@seesig.invalid> wrote:
> >smallpond <smallp...@juno.com> wrote:

>
> >> Single quotes are not used in html.

>
> >Single quotes are most certainly allowed in HTML.

>
> > * *http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2

>
> * * *^^
> So xml is a fix on html and '' is grandfathered in.
>
>
>
> > * * * *By default, SGML requires that all attribute values be delimited
> > * * * *using either double quotation marks (ASCII decimal 34) or single
> > * * * *quotation marks (ASCII decimal 39).

>
> And now, the king god SGML speaks it, deems it, * it!
> It is now in stone, and let no man take us'eth *er a under.
> So beith, as it was and will be, *<pause>, or forever hold your peace..<pause>,
> Amen!
>
> So sayeth we all !! Aye...
>
> -sln


Probably, it is how Apache2::Request handle the parameters. I am not
sure it is a bug, but hopefully I can find the solution.
I don't really want to mix with Apache2::Request with CGI script.
CGI:aram is working fine with the problems that I have described,
but when Apache2::Request:aram just doesn't understand the request
at all.
 
Reply With Quote
 
sln@netherlands.com
Guest
Posts: n/a
 
      03-07-2010
On Sat, 6 Mar 2010 19:31:17 -0800 (PST), kwan <> wrote:

>On Mar 6, 9:23*pm, s...@netherlands.com wrote:
>> On Sat, 06 Mar 2010 19:46:05 -0600, Tad McClellan <ta...@seesig.invalid> wrote:
>> >smallpond <smallp...@juno.com> wrote:

>>
>> >> Single quotes are not used in html.

>>
>> >Single quotes are most certainly allowed in HTML.

>>
>> > * *http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2

>>
>> * * *^^
>> So xml is a fix on html and '' is grandfathered in.
>>
>>
>>
>> > * * * *By default, SGML requires that all attribute values be delimited
>> > * * * *using either double quotation marks (ASCII decimal 34) or single
>> > * * * *quotation marks (ASCII decimal 39).

>>
>> And now, the king god SGML speaks it, deems it, * it!
>> It is now in stone, and let no man take us'eth *er a under.
>> So beith, as it was and will be, *<pause>, or forever hold your peace.. <pause>,
>> Amen!
>>
>> So sayeth we all !! Aye...
>>
>> -sln

>
>Probably, it is how Apache2::Request handle the parameters. I am not
>sure it is a bug, but hopefully I can find the solution.
>I don't really want to mix with Apache2::Request with CGI script.
>CGI:aram is working fine with the problems that I have described,
>but when Apache2::Request:aram just doesn't understand the request
>at all.


I won't say I could handle or fix your problem. I would say I have been
paid a lot of money to fix problems a lot of experts can't.

-sln
 
Reply With Quote
 
kwan
Guest
Posts: n/a
 
      03-08-2010
On Mar 6, 9:58*pm, s...@netherlands.com wrote:
> On Sat, 6 Mar 2010 19:31:17 -0800 (PST), kwan <kwan.ji...@gmail.com> wrote:
> >On Mar 6, 9:23 pm, s...@netherlands.com wrote:
> >> On Sat, 06 Mar 2010 19:46:05 -0600, Tad McClellan <ta...@seesig.invalid> wrote:
> >> >smallpond <smallp...@juno.com> wrote:

>
> >> >> Single quotes are not used in html.

>
> >> >Single quotes are most certainly allowed in HTML.

>
> >> >http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2

>
> >> ^^
> >> So xml is a fix on html and '' is grandfathered in.

>
> >> > By default, SGML requires that all attribute values be delimited
> >> > using either double quotation marks (ASCII decimal 34) or single
> >> > quotation marks (ASCII decimal 39).

>
> >> And now, the king god SGML speaks it, deems it, it!
> >> It is now in stone, and let no man take us'eth er a under.
> >> So beith, as it was and will be, <pause>, or forever hold your peace..<pause>,
> >> Amen!

>
> >> So sayeth we all !! Aye...

>
> >> -sln

>
> >Probably, it is how Apache2::Request handle the parameters. I am not
> >sure it is a bug, but hopefully I can find the solution.
> >I don't really want to mix with Apache2::Request with CGI script.
> >CGI:aram is working fine with the problems that I have described,
> >but when Apache2::Request:aram just doesn't understand the request
> >at all.

>
> I won't say I could handle or fix your problem. I would say I have been
> paid a lot of money to fix problems a lot of experts can't.
>
> -sln


I got the answer. It was the problem with the form.
<form method="POST" action="/app3">

</form>

I need action in order for the Apache2::Request:aram to be able to
query the parameter.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
IsInRole does not work as expected =?Utf-8?B?dmluZWV0YmF0dGE=?= ASP .Net 1 01-06-2007 10:27 AM
regex module, or don't work as expected Fabian Holler Python 3 07-04-2006 03:33 PM
ButtonColumn and EditCommandColumn don't work together as expected in DataGrid Piotr ASP .Net 0 01-06-2006 02:21 PM
Template.LoadControl(type,object[])...doesn't work as expected Keith Patrick ASP .Net 2 11-16-2005 04:01 PM
Config: Allow Roles does not work as expected Brian Takita ASP .Net 3 05-12-2005 06:30 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57