You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Igor Chudov <ic...@yahoo.com> on 2005/05/12 17:11:07 UTC

"strange error" is related to CGI.pm

A followup to my earlier post with this error:

Can't locate object method "read" via package
"Apache2::RequestRec" at (eval 26) line 6, <CONFIG>
line 522.\n, referer:
http://dsl.algebra.com/algebra/homework/word/numbers/04-num.wpm

The error happens when the latest CGI.pm version tries
to call "read" on Apache2::RequestRec, when the method
is POST. 

I had the same thing happen inside another custom
Handler of mine, and had to change POST to GET. I
would rather get to the bottom of the problem, I do
not like long GET urls.

Any thoughts?

- Igor



		
Yahoo! Mail
Stay connected, organized, and protected. Take the tour:
http://tour.mail.yahoo.com/mailtour.html


Re: "strange error" is related to CGI.pm

Posted by Willem Jan Withagen <wj...@withagen.nl>.
Hi,

Is there somewhere an example available which will list what modules and 
version you are running within a mod_perl environment??

Should look al little like phpinfo.php

Thanx,
--WjW

Re: It did not QUITE work! Re: "strange error" is related to CGI.pm

Posted by Igor Chudov <ic...@yahoo.com>.
> 
> I've no idea what CGI::Deurl is. I suppose you need
> to fix those errors, 
> they aren't anywhere related to mod_perl as far as I
> can see.

I just wrote my own version of Deurl, without any
functionality that interferes with CGI.pm. I will
update this list on how it goes, but I am beginning to
become optimistic.

i

- Igor


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: It did not QUITE work! Re: "strange error" is related to CGI.pm

Posted by Stas Bekman <st...@stason.org>.
Igor Chudov wrote:
[...]
>>>Of these two modules, CGI::Deurl is responsible.
>>>
>>>It does something strange here:
>>>
>>>sub load { 
>>>    my $data; 
>>>    if (defined $ENV{REQUEST_METHOD} and
>>>$ENV{REQUEST_METHOD} eq "POST") { 
>>>     read STDIN , $data , $ENV{CONTENT_LENGTH} ,0;
>>
>>
>>It assumes that it's the one that grabs the POST
>>data, so obviously CGI.pm 
>>doesn't work.
> 
> 
> Well, it used to work. I would not mind changing it to
> make it work again. 

May be the timing of the loading of that module was different, did you by 
chance switch from 'require' to 'use'?

> I just tried to invoke Deurl with NOTCGI argument, as
> Deurl suggests for those who do not want to read the
> query. When invoked with NOTCGI, Deurl/perl barfs
> saying:
> 
> failed to resolve handler `Algebra::Solver::Handler':
> BEGIN not safe after errors--compilation aborted at
> /data3/webdata/algebra.com/templates/Algebra/Solver/Handler.pm
> line 17.\nCompilation failed in require at (eval 18)
> line 3.\n

I've no idea what CGI::Deurl is. I suppose you need to fix those errors, 
they aren't anywhere related to mod_perl as far as I can see.

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Re: It did not QUITE work! Re: "strange error" is related to CGI.pm

Posted by Igor Chudov <ic...@yahoo.com>.
--- Stas Bekman <st...@stason.org> wrote:

> Igor, please trim your replies to include only the
> quotes you are replying 
> to. Thank you.

Good point, thanks.

> Igor Chudov wrote:
> > Of these two modules, CGI::Deurl is responsible.
> > 
> > It does something strange here:
> > 
> > sub load { 
> >     my $data; 
> >     if (defined $ENV{REQUEST_METHOD} and
> > $ENV{REQUEST_METHOD} eq "POST") { 
> >      read STDIN , $data , $ENV{CONTENT_LENGTH} ,0;
> 
> 
> It assumes that it's the one that grabs the POST
> data, so obviously CGI.pm 
> doesn't work.

Well, it used to work. I would not mind changing it to
make it work again. 

I just tried to invoke Deurl with NOTCGI argument, as
Deurl suggests for those who do not want to read the
query. When invoked with NOTCGI, Deurl/perl barfs
saying:

failed to resolve handler `Algebra::Solver::Handler':
BEGIN not safe after errors--compilation aborted at
/data3/webdata/algebra.com/templates/Algebra/Solver/Handler.pm
line 17.\nCompilation failed in require at (eval 18)
line 3.\n


- Igor



		
Yahoo! Mail
Stay connected, organized, and protected. Take the tour:
http://tour.mail.yahoo.com/mailtour.html


Re: It did not QUITE work! Re: "strange error" is related to CGI.pm

Posted by Stas Bekman <st...@stason.org>.
Igor, please trim your replies to include only the quotes you are replying 
to. Thank you.

Igor Chudov wrote:
> Of these two modules, CGI::Deurl is responsible.
> 
> It does something strange here:
> 
> sub load { 
>     my $data; 
>     if (defined $ENV{REQUEST_METHOD} and
> $ENV{REQUEST_METHOD} eq "POST") { 
>      read STDIN , $data , $ENV{CONTENT_LENGTH} ,0; 

It assumes that it's the one that grabs the POST data, so obviously CGI.pm 
doesn't work.

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Re: It did not QUITE work! Re: "strange error" is related to CGI.pm

Posted by Igor Chudov <ic...@yahoo.com>.
Of these two modules, CGI::Deurl is responsible.

It does something strange here:

sub load { 
    my $data; 
    if (defined $ENV{REQUEST_METHOD} and
$ENV{REQUEST_METHOD} eq "POST") { 
     read STDIN , $data , $ENV{CONTENT_LENGTH} ,0; 


i

--- Igor Chudov <ic...@yahoo.com> wrote:

> I made some effort to reproduce it and made an
> unbelievable discovery.
> 
> If I include these two statements:
> 
> use CGI::Deurl;
> use CGI::Enurl;
> 
> then things do NOT work properly.
> 
> If I comment them out, then everything works fine.
> The
> use statements are as follows:
> 
> use CGI qw/:standard/;
> use CGI::Pretty;
> use APR::Table ();
> use CGI::Deurl;
> use CGI::Enurl;
> use Apache2::Const qw( OK );
> 
> I have a SAMPLE that does not use any of my
> algebra.com's code:
> 
> http://dsl.algebra.com/tmp/solver/TestHandler.pm.txt
> 
> I invoke it by saying
> 
> <Files *.testhandler> 
>         SetHandler perl-script 
>         PerlHandler Algebra::Solver::TestHandler 
>         Options +ExecCGI 
>         #optional 
>         PerlSendHeader On 
> </Files> 
> 
> 
> --- Stas Bekman <st...@stason.org> wrote:
> 
> > Igor Chudov wrote:
> > > --- Stas Bekman <st...@stason.org> wrote:
> > [...]
> > >>>I already applied this patch (at Randy's
> > >>
> > >>suggestion, I
> > >>
> > >>>think). It did not help.
> > >>
> > >>so what's the latest error that you get? The
> > easiest
> > >>way to help us to 
> > >>reproduce the problem is to download the
> > Apache-Test
> > >>Skeleton, that you 
> > >>can find linked from here:
> > >>
> > > 
> > >
> >
>
http://perl.apache.org/docs/2.0/user/help/help.html#Problem_Description
> > > 
> > >>add a *minimal* code that we can reproduce your
> > >>problem with and send it 
> > >>here. Once we have it and we can reproduce it,
> it
> > >>should be trivial to fix.
> > > 
> > > 
> > > I do not get any error, however, CGI does not
> > return
> > > te needed form parameter value. As though the
> > value
> > > was never passed to the form. If I change the
> > method
> > > from POST to GET, everything is fine.
> > 
> > OK, so that's a different story. But the 'require
> > Apache2::RequestIO;' was 
> >   indeed needed, correct? As I have submitted a
> > patch to Lincoln for CGI.pm.
> > 
> > > I will try to reproduce the minimal handler that
> > > reproduces the problem.
> > 
> > While you do that, take a look at the mod_perl
> tests
> > as suggested by 
> > Randy. You will see how to write this kind of
> tests.
> > 
> > -- 
> >
>
__________________________________________________________________
> > Stas Bekman            JAm_pH ------> Just Another
> > mod_perl Hacker
> > http://stason.org/     mod_perl Guide --->
> > http://perl.apache.org
> > mailto:stas@stason.org http://use.perl.org
> > http://apacheweek.com
> > http://modperlbook.org http://apache.org  
> > http://ticketmaster.com
> > 
> 
> 
> - Igor
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> http://mail.yahoo.com 
> 


- Igor


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: It did not QUITE work! Re: "strange error" is related to CGI.pm

Posted by Igor Chudov <ic...@yahoo.com>.
I made some effort to reproduce it and made an
unbelievable discovery.

If I include these two statements:

use CGI::Deurl;
use CGI::Enurl;

then things do NOT work properly.

If I comment them out, then everything works fine. The
use statements are as follows:

use CGI qw/:standard/;
use CGI::Pretty;
use APR::Table ();
use CGI::Deurl;
use CGI::Enurl;
use Apache2::Const qw( OK );

I have a SAMPLE that does not use any of my
algebra.com's code:

http://dsl.algebra.com/tmp/solver/TestHandler.pm.txt

I invoke it by saying

<Files *.testhandler> 
        SetHandler perl-script 
        PerlHandler Algebra::Solver::TestHandler 
        Options +ExecCGI 
        #optional 
        PerlSendHeader On 
</Files> 


--- Stas Bekman <st...@stason.org> wrote:

> Igor Chudov wrote:
> > --- Stas Bekman <st...@stason.org> wrote:
> [...]
> >>>I already applied this patch (at Randy's
> >>
> >>suggestion, I
> >>
> >>>think). It did not help.
> >>
> >>so what's the latest error that you get? The
> easiest
> >>way to help us to 
> >>reproduce the problem is to download the
> Apache-Test
> >>Skeleton, that you 
> >>can find linked from here:
> >>
> > 
> >
>
http://perl.apache.org/docs/2.0/user/help/help.html#Problem_Description
> > 
> >>add a *minimal* code that we can reproduce your
> >>problem with and send it 
> >>here. Once we have it and we can reproduce it, it
> >>should be trivial to fix.
> > 
> > 
> > I do not get any error, however, CGI does not
> return
> > te needed form parameter value. As though the
> value
> > was never passed to the form. If I change the
> method
> > from POST to GET, everything is fine.
> 
> OK, so that's a different story. But the 'require
> Apache2::RequestIO;' was 
>   indeed needed, correct? As I have submitted a
> patch to Lincoln for CGI.pm.
> 
> > I will try to reproduce the minimal handler that
> > reproduces the problem.
> 
> While you do that, take a look at the mod_perl tests
> as suggested by 
> Randy. You will see how to write this kind of tests.
> 
> -- 
>
__________________________________________________________________
> Stas Bekman            JAm_pH ------> Just Another
> mod_perl Hacker
> http://stason.org/     mod_perl Guide --->
> http://perl.apache.org
> mailto:stas@stason.org http://use.perl.org
> http://apacheweek.com
> http://modperlbook.org http://apache.org  
> http://ticketmaster.com
> 


- Igor


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: It did not QUITE work! Re: "strange error" is related to CGI.pm

Posted by Stas Bekman <st...@stason.org>.
Igor Chudov wrote:
> --- Stas Bekman <st...@stason.org> wrote:
[...]
>>>I already applied this patch (at Randy's
>>
>>suggestion, I
>>
>>>think). It did not help.
>>
>>so what's the latest error that you get? The easiest
>>way to help us to 
>>reproduce the problem is to download the Apache-Test
>>Skeleton, that you 
>>can find linked from here:
>>
> 
> http://perl.apache.org/docs/2.0/user/help/help.html#Problem_Description
> 
>>add a *minimal* code that we can reproduce your
>>problem with and send it 
>>here. Once we have it and we can reproduce it, it
>>should be trivial to fix.
> 
> 
> I do not get any error, however, CGI does not return
> te needed form parameter value. As though the value
> was never passed to the form. If I change the method
> from POST to GET, everything is fine.

OK, so that's a different story. But the 'require Apache2::RequestIO;' was 
  indeed needed, correct? As I have submitted a patch to Lincoln for CGI.pm.

> I will try to reproduce the minimal handler that
> reproduces the problem.

While you do that, take a look at the mod_perl tests as suggested by 
Randy. You will see how to write this kind of tests.

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Re: It did not QUITE work! Re: "strange error" is related to CGI.pm

Posted by Igor Chudov <ic...@yahoo.com>.
--- Stas Bekman <st...@stason.org> wrote:

> Igor Chudov wrote:
> > --- Stas Bekman <st...@stason.org> wrote:
> > 
> > 
> >>Stas Bekman wrote:
> >>
> >>>Igor Chudov wrote:
> >>>
> >>>
> >>>>I was too quick to say that it worked. It does
> >>
> >>not
> >>
> >>>>quite work with another PerlHandler of mine.
> >>>>I make a form, if I submit it with a GET method,
> >>
> >>it
> >>
> >>>>works. If I submit it with a POST handler, CGI
> >>
> >>fails
> >>
> >>>>to get parameters. I am most puzzled.
> >>>
> >>>
> >>>Add:
> >>>
> >>>PerlModule Apache2::RequestIO
> >>>
> >>>at the server startup then.
> >>>
> >>>Next check that you are using the latest CGI.pm
> >>
> >>which should work fine. 
> >>
> >>>Which CGI.pm version do you use?
> >>
> >>Actually scratch that. 
> > 
> > 
> > Thanks. I tried it and it did not help.
> > 
> > 
> >>It seems like a bug in
> >>CGI.pm. Please try this patch:
> >>
> >>--- CGI.pm.orig 2005-05-13 12:09:12.000000000
> -0400
> >>+++ CGI.pm      2005-05-13 12:09:22.000000000
> -0400
> >>@@ -184,6 +184,7 @@
> >>      require Apache2::Response;
> >>      require Apache2::RequestRec;
> >>      require Apache2::RequestUtil;
> >>+    require Apache2::RequestIO;
> >>      require APR::Pool;
> >>    } else {
> >>      $MOD_PERL = 1;
> > 
> > 
> > I already applied this patch (at Randy's
> suggestion, I
> > think). It did not help.
> 
> so what's the latest error that you get? The easiest
> way to help us to 
> reproduce the problem is to download the Apache-Test
> Skeleton, that you 
> can find linked from here:
>
http://perl.apache.org/docs/2.0/user/help/help.html#Problem_Description
> 
> add a *minimal* code that we can reproduce your
> problem with and send it 
> here. Once we have it and we can reproduce it, it
> should be trivial to fix.

I do not get any error, however, CGI does not return
te needed form parameter value. As though the value
was never passed to the form. If I change the method
from POST to GET, everything is fine.

I will try to reproduce the minimal handler that
reproduces the problem.

igor


- Igor



		
Discover Yahoo! 
Use Yahoo! to plan a weekend, have fun online and more. Check it out! 
http://discover.yahoo.com/

Re: It did not QUITE work! Re: "strange error" is related to CGI.pm

Posted by Stas Bekman <st...@stason.org>.
Igor Chudov wrote:
> --- Stas Bekman <st...@stason.org> wrote:
> 
> 
>>Stas Bekman wrote:
>>
>>>Igor Chudov wrote:
>>>
>>>
>>>>I was too quick to say that it worked. It does
>>
>>not
>>
>>>>quite work with another PerlHandler of mine.
>>>>I make a form, if I submit it with a GET method,
>>
>>it
>>
>>>>works. If I submit it with a POST handler, CGI
>>
>>fails
>>
>>>>to get parameters. I am most puzzled.
>>>
>>>
>>>Add:
>>>
>>>PerlModule Apache2::RequestIO
>>>
>>>at the server startup then.
>>>
>>>Next check that you are using the latest CGI.pm
>>
>>which should work fine. 
>>
>>>Which CGI.pm version do you use?
>>
>>Actually scratch that. 
> 
> 
> Thanks. I tried it and it did not help.
> 
> 
>>It seems like a bug in
>>CGI.pm. Please try this patch:
>>
>>--- CGI.pm.orig 2005-05-13 12:09:12.000000000 -0400
>>+++ CGI.pm      2005-05-13 12:09:22.000000000 -0400
>>@@ -184,6 +184,7 @@
>>      require Apache2::Response;
>>      require Apache2::RequestRec;
>>      require Apache2::RequestUtil;
>>+    require Apache2::RequestIO;
>>      require APR::Pool;
>>    } else {
>>      $MOD_PERL = 1;
> 
> 
> I already applied this patch (at Randy's suggestion, I
> think). It did not help.

so what's the latest error that you get? The easiest way to help us to 
reproduce the problem is to download the Apache-Test Skeleton, that you 
can find linked from here:
http://perl.apache.org/docs/2.0/user/help/help.html#Problem_Description

add a *minimal* code that we can reproduce your problem with and send it 
here. Once we have it and we can reproduce it, it should be trivial to fix.

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Re: It did not QUITE work! Re: "strange error" is related to CGI.pm

Posted by Igor Chudov <ic...@yahoo.com>.
--- Stas Bekman <st...@stason.org> wrote:

> Stas Bekman wrote:
> > Igor Chudov wrote:
> > 
> >> I was too quick to say that it worked. It does
> not
> >> quite work with another PerlHandler of mine.
> >> I make a form, if I submit it with a GET method,
> it
> >> works. If I submit it with a POST handler, CGI
> fails
> >> to get parameters. I am most puzzled.
> > 
> > 
> > Add:
> > 
> > PerlModule Apache2::RequestIO
> > 
> > at the server startup then.
> > 
> > Next check that you are using the latest CGI.pm
> which should work fine. 
> > Which CGI.pm version do you use?
> 
> Actually scratch that. 

Thanks. I tried it and it did not help.

> It seems like a bug in
> CGI.pm. Please try this patch:
> 
> --- CGI.pm.orig 2005-05-13 12:09:12.000000000 -0400
> +++ CGI.pm      2005-05-13 12:09:22.000000000 -0400
> @@ -184,6 +184,7 @@
>       require Apache2::Response;
>       require Apache2::RequestRec;
>       require Apache2::RequestUtil;
> +    require Apache2::RequestIO;
>       require APR::Pool;
>     } else {
>       $MOD_PERL = 1;

I already applied this patch (at Randy's suggestion, I
think). It did not help.

i

- Igor



		
__________________________________ 
Do you Yahoo!? 
Read only the mail you want - Yahoo! Mail SpamGuard. 
http://promotions.yahoo.com/new_mail 

Re: It did not QUITE work! Re: "strange error" is related to CGI.pm

Posted by Stas Bekman <st...@stason.org>.
Stas Bekman wrote:
> Igor Chudov wrote:
> 
>> I was too quick to say that it worked. It does not
>> quite work with another PerlHandler of mine.
>> I make a form, if I submit it with a GET method, it
>> works. If I submit it with a POST handler, CGI fails
>> to get parameters. I am most puzzled.
> 
> 
> Add:
> 
> PerlModule Apache2::RequestIO
> 
> at the server startup then.
> 
> Next check that you are using the latest CGI.pm which should work fine. 
> Which CGI.pm version do you use?

Actually scratch that. It seems like a bug in CGI.pm. Please try this patch:

--- CGI.pm.orig 2005-05-13 12:09:12.000000000 -0400
+++ CGI.pm      2005-05-13 12:09:22.000000000 -0400
@@ -184,6 +184,7 @@
      require Apache2::Response;
      require Apache2::RequestRec;
      require Apache2::RequestUtil;
+    require Apache2::RequestIO;
      require APR::Pool;
    } else {
      $MOD_PERL = 1;


-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Re: It did not QUITE work! Re: "strange error" is related to CGI.pm

Posted by Igor Chudov <ic...@yahoo.com>.
--- Stas Bekman <st...@stason.org> wrote:

> Igor Chudov wrote:
> > I was too quick to say that it worked. It does not
> > quite work with another PerlHandler of mine. 
> > 
> > I make a form, if I submit it with a GET method,
> it
> > works. If I submit it with a POST handler, CGI
> fails
> > to get parameters. I am most puzzled.
> 
> Add:
> 
> PerlModule Apache2::RequestIO
> 
> at the server startup then.
> 
> Next check that you are using the latest CGI.pm
> which should work fine. 
> Which CGI.pm version do you use?


I did exactly what you suggested, but it did not work.

Perl 5.8.6
httpd-2.0.54
mod_perl-2.0.0-RC6
libapreq2.so.2.1.0
CGI.pm v 3.09

I am quite lost, to be honest. I am very willing to
spend as much time as necessary to aid in diagnosing
it properly.

igor

> 
> -- 
>
__________________________________________________________________
> Stas Bekman            JAm_pH ------> Just Another
> mod_perl Hacker
> http://stason.org/     mod_perl Guide --->
> http://perl.apache.org
> mailto:stas@stason.org http://use.perl.org
> http://apacheweek.com
> http://modperlbook.org http://apache.org  
> http://ticketmaster.com
> 


- Igor



		
Yahoo! Mail
Stay connected, organized, and protected. Take the tour:
http://tour.mail.yahoo.com/mailtour.html


Re: It did not QUITE work! Re: "strange error" is related to CGI.pm

Posted by Stas Bekman <st...@stason.org>.
Igor Chudov wrote:
> I was too quick to say that it worked. It does not
> quite work with another PerlHandler of mine. 
> 
> I make a form, if I submit it with a GET method, it
> works. If I submit it with a POST handler, CGI fails
> to get parameters. I am most puzzled.

Add:

PerlModule Apache2::RequestIO

at the server startup then.

Next check that you are using the latest CGI.pm which should work fine. 
Which CGI.pm version do you use?


-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Re: It did not QUITE work! Re: "strange error" is related to CGI.pm

Posted by Stas Bekman <st...@stason.org>.
Randy Kobes wrote:
> On Fri, 13 May 2005, Igor Chudov wrote:
> 
> 
>>I was too quick to say that it worked. It does not
>>quite work with another PerlHandler of mine.
>>
>>I make a form, if I submit it with a GET method, it
>>works. If I submit it with a POST handler, CGI fails
>>to get parameters. I am most puzzled.
> 
> 
> That is strange - there's a couple of tests in the
> mp2 distribution (under t/modules/) that test POST
> requests with CGI.pm. The handlers are simply:

Randy, it just happens to work, since Apache2::RequestIO is loaded 
elsewhere. See the patch in the other reply.

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Re: It did not QUITE work! Re: "strange error" is related to CGI.pm

Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Fri, 13 May 2005, Igor Chudov wrote:

> I was too quick to say that it worked. It does not
> quite work with another PerlHandler of mine.
>
> I make a form, if I submit it with a GET method, it
> works. If I submit it with a POST handler, CGI fails
> to get parameters. I am most puzzled.

That is strange - there's a couple of tests in the
mp2 distribution (under t/modules/) that test POST
requests with CGI.pm. The handlers are simply:
======================================================
package TestModules::cgipost;
use strict;
use warnings FATAL => 'all';
use Apache2::compat ();
use CGI ();
use Apache2::Const -compile => 'OK';
sub handler {
    my $r = shift;
    $r->content_type('text/plain');
    my $cgi = CGI->new;
    print join ":", map { $cgi->param($_) } $cgi->param;
    Apache2::Const::OK;
}
1;
__END__
SetHandler perl-script
PerlOptions +GlobalRequest
=========================================================

and

========================================================
package TestModules::cgipost2;
# this handler doesn't use the :Apache layer, so CGI.pm needs to do
# $r->read(...)  instead of read(STDIN,...)
use strict;
use warnings FATAL => 'all';
use Apache2::compat ();
use CGI ();
use Apache2::Const -compile => 'OK';
sub handler {
    my $r = shift;
    $r->content_type('text/plain');
    my $cgi = CGI->new($r);
    $r->print(join ":", map { $cgi->param($_) } $cgi->param);
    Apache2::Const::OK;
}
1;
__END__
================================================================

Did these tests pass for you? Do these offer any clue
as to why yours doesn't work? If not, can you send a
minimal example of what doesn't work, along with the
relevant configuration directives?

-- 
best regards,
randy

It did not QUITE work! Re: "strange error" is related to CGI.pm

Posted by Igor Chudov <ic...@yahoo.com>.
I was too quick to say that it worked. It does not
quite work with another PerlHandler of mine. 

I make a form, if I submit it with a GET method, it
works. If I submit it with a POST handler, CGI fails
to get parameters. I am most puzzled.

i

--- Randy Kobes <ra...@theoryx5.uwinnipeg.ca> wrote:

> On Fri, 13 May 2005, Igor Chudov wrote:
> 
> > --- Randy Kobes <ra...@theoryx5.uwinnipeg.ca>
> wrote:
> >
> > > On Fri, 13 May 2005, Igor Chudov wrote:
> > >
> > > > --- Tom Schindl <to...@gmx.at> wrote:
> > > >
> > > > > -----BEGIN PGP SIGNED MESSAGE-----
> > > > > Hash: SHA1
> > > > >
> > > > > If you have installed Apach2::Request or you
> don't
> > > > > need CGI.pm any more.
> > > >
> > > > Sorry, I use CGI.pm for everything.
> > > >
> > > > > You are also failing to tell us what mp2 and
> apache2
> > > > > you are running so everything I can do is
> guessing.
> > > >
> > > > Perl 5.8.6
> > > > httpd-2.0.54
> > > > mod_perl-2.0.0-RC6
> > > > libapreq2.so.2.1.0
> > > > CGI.pm v 3.09
> > >
> > > What if you try adding, in CGI.pm, a line
> > >    require Apache2::RequestIO;
> > > in the same block that Apache2::RequestRec, etc.
> are
> > > being require()d.
> >
> > Randy, it worked!!! Yay! I am happy!
> >
> > Can you tell me why it helped? I will appreciate.
> 
> One of the design considerations of mod_perl-2 is to
> cut
> down on memory usage by splitting functionality
> across
> different modules, so that a user only loads the
> ones
> needed. Thus, you need to require Apache2::RequestIO
> in order to get the "read" method. It's sometimes
> not
> apparent which module is needed for which method;
> for
> this, ModPerl::MethodLookup:
> 
>
http://perl.apache.org/docs/2.0/api/ModPerl/MethodLooup.html
> can help.
> 
> -- 
> best regards,
> randy
> 


- Igor


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: IT WORKED! Re: "strange error" is related to CGI.pm

Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Fri, 13 May 2005, Igor Chudov wrote:

> --- Randy Kobes <ra...@theoryx5.uwinnipeg.ca> wrote:
>
> > On Fri, 13 May 2005, Igor Chudov wrote:
> >
> > > --- Tom Schindl <to...@gmx.at> wrote:
> > >
> > > > -----BEGIN PGP SIGNED MESSAGE-----
> > > > Hash: SHA1
> > > >
> > > > If you have installed Apach2::Request or you don't
> > > > need CGI.pm any more.
> > >
> > > Sorry, I use CGI.pm for everything.
> > >
> > > > You are also failing to tell us what mp2 and apache2
> > > > you are running so everything I can do is guessing.
> > >
> > > Perl 5.8.6
> > > httpd-2.0.54
> > > mod_perl-2.0.0-RC6
> > > libapreq2.so.2.1.0
> > > CGI.pm v 3.09
> >
> > What if you try adding, in CGI.pm, a line
> >    require Apache2::RequestIO;
> > in the same block that Apache2::RequestRec, etc. are
> > being require()d.
>
> Randy, it worked!!! Yay! I am happy!
>
> Can you tell me why it helped? I will appreciate.

One of the design considerations of mod_perl-2 is to cut
down on memory usage by splitting functionality across
different modules, so that a user only loads the ones
needed. Thus, you need to require Apache2::RequestIO
in order to get the "read" method. It's sometimes not
apparent which module is needed for which method; for
this, ModPerl::MethodLookup:
 http://perl.apache.org/docs/2.0/api/ModPerl/MethodLooup.html
can help.

-- 
best regards,
randy

IT WORKED! Re: "strange error" is related to CGI.pm

Posted by Igor Chudov <ic...@yahoo.com>.
--- Randy Kobes <ra...@theoryx5.uwinnipeg.ca> wrote:

> On Fri, 13 May 2005, Igor Chudov wrote:
> 
> > --- Tom Schindl <to...@gmx.at> wrote:
> >
> > > -----BEGIN PGP SIGNED MESSAGE-----
> > > Hash: SHA1
> > >
> > > If you have installed Apach2::Request or you
> don't
> > > need CGI.pm any more.
> >
> > Sorry, I use CGI.pm for everything.
> >
> > > You are also failing to tell us what mp2 and
> apache2
> > > you are running so
> > > everything I can do is guessing.
> >
> > Perl 5.8.6
> > httpd-2.0.54
> > mod_perl-2.0.0-RC6
> > libapreq2.so.2.1.0
> > CGI.pm v 3.09
> 
> What if you try adding, in CGI.pm, a line
>    require Apache2::RequestIO;
> in the same block that Apache2::RequestRec, etc. are
> being require()d.

Randy, it worked!!! Yay! I am happy!

Can you tell me why it helped? I will appreciate. 

Thank you so much!

i


> 
> -- 
> best regards,
> randy kobes
> 


- Igor



		
__________________________________ 
Do you Yahoo!? 
Read only the mail you want - Yahoo! Mail SpamGuard. 
http://promotions.yahoo.com/new_mail 

Re: "strange error" is related to CGI.pm

Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Fri, 13 May 2005, Igor Chudov wrote:

> --- Tom Schindl <to...@gmx.at> wrote:
>
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > If you have installed Apach2::Request or you don't
> > need CGI.pm any more.
>
> Sorry, I use CGI.pm for everything.
>
> > You are also failing to tell us what mp2 and apache2
> > you are running so
> > everything I can do is guessing.
>
> Perl 5.8.6
> httpd-2.0.54
> mod_perl-2.0.0-RC6
> libapreq2.so.2.1.0
> CGI.pm v 3.09

What if you try adding, in CGI.pm, a line
   require Apache2::RequestIO;
in the same block that Apache2::RequestRec, etc. are
being require()d.

-- 
best regards,
randy kobes

Re: "strange error" is related to CGI.pm

Posted by Igor Chudov <ic...@yahoo.com>.
--- Tom Schindl <to...@gmx.at> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> If you have installed Apach2::Request or you don't
> need CGI.pm any more.

Sorry, I use CGI.pm for everything.

> You are also failing to tell us what mp2 and apache2
> you are running so
> everything I can do is guessing. 

Perl 5.8.6
httpd-2.0.54
mod_perl-2.0.0-RC6
libapreq2.so.2.1.0
CGI.pm v 3.09


> Maybe you did that
> in the thread you
> are referencing but I have no time to search the
> archives. If you follow
> up the another thread you started please reply to
> this thread and then
> our mail-agents can deal with it, else provide a
> link to a mail-archive.
> 
> I think that you're biten by the fact that you are
> running the latest
> and greatest CGI.pm and a mp2 version prior to mp2
> RC5 and those can not
> work with each other.

I wish! Unfortunately, pretty much everything I am
running is the latest and I completely nuked the old
perl installation.

i

> Tom
> 
> Tom Schindl schrieb:
> | Hi,
> |
> | use Apache2::Request aka libapreq2 if possible.
> |
> | Tom
> |
> | Igor Chudov schrieb:
> | | A followup to my earlier post with this error:
> | |
> | | Can't locate object method "read" via package
> | | "Apache2::RequestRec" at (eval 26) line 6,
> <CONFIG>
> | | line 522.\n, referer:
> | |
>
http://dsl.algebra.com/algebra/homework/word/numbers/04-num.wpm
> | |
> | | The error happens when the latest CGI.pm version
> tries
> | | to call "read" on Apache2::RequestRec, when the
> method
> | | is POST.
> | |
> | | I had the same thing happen inside another
> custom
> | | Handler of mine, and had to change POST to GET.
> I
> | | would rather get to the bottom of the problem, I
> do
> | | not like long GET urls.
> | |
> | | Any thoughts?
> | |
> | | - Igor
> | |
> | |
> | |
> | |
> | | Yahoo! Mail
> | | Stay connected, organized, and protected. Take
> the tour:
> | | http://tour.mail.yahoo.com/mailtour.html
> | |
> | |
> |
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.0 (GNU/Linux)
> Comment: Using GnuPG with Thunderbird -
> http://enigmail.mozdev.org
> 
>
iD8DBQFChK31kVPeOFLgZFIRAmlDAJ9mTMG+BOE+1nEUa8JipPK/yTPlYgCfTsUw
> /h3MdqCv5Oa5nBBFxfLZVfE=
> =blrN
> -----END PGP SIGNATURE-----
> 


- Igor



		
Yahoo! Mail
Stay connected, organized, and protected. Take the tour:
http://tour.mail.yahoo.com/mailtour.html


Re: "strange error" is related to CGI.pm

Posted by Tom Schindl <to...@gmx.at>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If you have installed Apach2::Request or you don't need CGI.pm any more.
You are also failing to tell us what mp2 and apache2 you are running so
everything I can do is guessing. Maybe you did that in the thread you
are referencing but I have no time to search the archives. If you follow
up the another thread you started please reply to this thread and then
our mail-agents can deal with it, else provide a link to a mail-archive.

I think that you're biten by the fact that you are running the latest
and greatest CGI.pm and a mp2 version prior to mp2 RC5 and those can not
work with each other.

Tom

Tom Schindl schrieb:
| Hi,
|
| use Apache2::Request aka libapreq2 if possible.
|
| Tom
|
| Igor Chudov schrieb:
| | A followup to my earlier post with this error:
| |
| | Can't locate object method "read" via package
| | "Apache2::RequestRec" at (eval 26) line 6, <CONFIG>
| | line 522.\n, referer:
| | http://dsl.algebra.com/algebra/homework/word/numbers/04-num.wpm
| |
| | The error happens when the latest CGI.pm version tries
| | to call "read" on Apache2::RequestRec, when the method
| | is POST.
| |
| | I had the same thing happen inside another custom
| | Handler of mine, and had to change POST to GET. I
| | would rather get to the bottom of the problem, I do
| | not like long GET urls.
| |
| | Any thoughts?
| |
| | - Igor
| |
| |
| |
| |
| | Yahoo! Mail
| | Stay connected, organized, and protected. Take the tour:
| | http://tour.mail.yahoo.com/mailtour.html
| |
| |
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFChK31kVPeOFLgZFIRAmlDAJ9mTMG+BOE+1nEUa8JipPK/yTPlYgCfTsUw
/h3MdqCv5Oa5nBBFxfLZVfE=
=blrN
-----END PGP SIGNATURE-----

Re: "strange error" is related to CGI.pm

Posted by Igor Chudov <ic...@yahoo.com>.
Well, Apache2::Request is installed on my system
(according to CPAN perl module), and I still get the
same error.

[Fri May 13 08:09:37 2005] [error] [client
64.94.157.1] Can't locate object method "read" via
package "Apache2::RequestRec" at (eval 26) line 6,
<CONFIG> line 522.\n, referer:
http://dsl.algebra.com/algebra/homework/word/numbers/04-num.wpm

cpan> install Apache2::Request
CPAN: Storable loaded ok
Going to read /root/.cpan/Metadata
  Database was generated on Thu, 12 May 2005 21:56:07
GMT
Apache2::Request is up to date.

/usr/lib/perl5==>find . -name Request.pm |grep Apache2
./site_perl/5.8.6/i686-linux/Apache2/Request.pm


i


--- Tom Schindl <to...@gmx.at> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi,
> 
> use Apache2::Request aka libapreq2 if possible.
> 
> Tom
> 
> Igor Chudov schrieb:
> | A followup to my earlier post with this error:
> |
> | Can't locate object method "read" via package
> | "Apache2::RequestRec" at (eval 26) line 6,
> <CONFIG>
> | line 522.\n, referer:
> |
>
http://dsl.algebra.com/algebra/homework/word/numbers/04-num.wpm
> |
> | The error happens when the latest CGI.pm version
> tries
> | to call "read" on Apache2::RequestRec, when the
> method
> | is POST.
> |
> | I had the same thing happen inside another custom
> | Handler of mine, and had to change POST to GET. I
> | would rather get to the bottom of the problem, I
> do
> | not like long GET urls.
> |
> | Any thoughts?
> |
> | - Igor
> |
> |
> |
> | 		
> | Yahoo! Mail
> | Stay connected, organized, and protected. Take the
> tour:
> | http://tour.mail.yahoo.com/mailtour.html
> |
> |
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.0 (GNU/Linux)
> Comment: Using GnuPG with Thunderbird -
> http://enigmail.mozdev.org
> 
>
iD8DBQFChGF0kVPeOFLgZFIRArO/AJ0ePA/RHAsEkXO6JzFQv3uqzxfRygCgs3BM
> eJsTrqTVdUSqAaKo7uwDLWw=
> =CV8Q
> -----END PGP SIGNATURE-----
> 


- Igor


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: "strange error" is related to CGI.pm

Posted by Tom Schindl <to...@gmx.at>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

use Apache2::Request aka libapreq2 if possible.

Tom

Igor Chudov schrieb:
| A followup to my earlier post with this error:
|
| Can't locate object method "read" via package
| "Apache2::RequestRec" at (eval 26) line 6, <CONFIG>
| line 522.\n, referer:
| http://dsl.algebra.com/algebra/homework/word/numbers/04-num.wpm
|
| The error happens when the latest CGI.pm version tries
| to call "read" on Apache2::RequestRec, when the method
| is POST.
|
| I had the same thing happen inside another custom
| Handler of mine, and had to change POST to GET. I
| would rather get to the bottom of the problem, I do
| not like long GET urls.
|
| Any thoughts?
|
| - Igor
|
|
|
| 		
| Yahoo! Mail
| Stay connected, organized, and protected. Take the tour:
| http://tour.mail.yahoo.com/mailtour.html
|
|

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFChGF0kVPeOFLgZFIRArO/AJ0ePA/RHAsEkXO6JzFQv3uqzxfRygCgs3BM
eJsTrqTVdUSqAaKo7uwDLWw=
=CV8Q
-----END PGP SIGNATURE-----