$r->args()

2001-08-29 Thread Rasoul Hajikhani

Hello, 
I already have asked this question and got an answer for it, so please
accept my forwarded apologies. However, I was trying something else and
got stuck. I know in order to pass around query string, or form data,
pnotes may be used. However, I am trying something else and it does not
seem to work! 

.
.
.
$r = Apache::Request->new($r);
# check for some condition
if ($condition)
{
my $previous_uri= $r->param('previous_uri');

my $content = $r->param();

$r->method_number(M_GET);
$r->method('GET');

$r->headers_in->unset("Content-length");

$r->args($content);

$r->internal_redirect("$previous_uri");
}
.
.
.
However, in my called handler, no Post data can be read. Can any one
tell me why is that?
Any comments welcomed...
Thanks
-r



$r->args()

2001-08-29 Thread Rasoul Hajikhani

Hello, 
I already have asked this question and got an answer for it, so please
accept my forwarded apologies. However, I was trying something else and
got stuck. I know in order to pass around query string, or form data,
pnotes may be used. However, I am trying something else and it does not
seem to work! 

.
.
.
$r = Apache::Request->new($r);
# check for some condition
if ($condition)
{
my $previous_uri= $r->param('previous_uri');

my $content = $r->param();

$r->method_number(M_GET);
$r->method('GET');

$r->headers_in->unset("Content-length");

$r->args($content);

$r->internal_redirect("$previous_uri");
}
.
.
.
However, in my called handler, no Post data can be read. Can any one
tell me why is that?
Any comments welcomed...
Thanks
-r



$r->args troubles...

2000-04-07 Thread Jason Murphy

Dear Mod_Perl'lers

I hate to bug the list with this simple problem, but I am at my wits end. I
have The Good Book (Aka: Apache Modules with Perl and C. Aka: The Eagle
Book) but have some questions that are just killing me.

I would like to do something like the program on page 104 - 110 and also
page 130 - 135 of The Eagle book. For those of you not blessed with this
book, I am trying to recover the parameter from a GET request. Below is my
code I correctly using, but my problem is the Apache::Request and
Apache::Constant are not being found or used or whatever is the error (Error
posted below).

Some notes, I have tried adding "use Apache::Constants qw(:common)" but it
also returns the same error. I have also replaced the last line with "my
($FirstInfo, $SecondInfo) = split /=/, $r->args;" with no success either. I
have those modules installed, and I forced reinstalled them to make sure
along with Bundle::Apache.

If anyone could point me to a really good example of the r->args and GET
requests I would really appreciate it.

<---My Error--->

Can't locate object method "new" via package "Apache::Request" at
./find_player.pl line 10.



<---MY CODE--->

use strict;

use Apache::Request ();
use CGI qw(:standard);
use DBI;

my $r = new Apache::Request;  <---Where the error appears
my $dbh ||= DBI->connect('dbi:mysql:Action', 'login', 'password') || die
"Could not open Database: ";

my ($person_id, $name, $totalkills, $totalkilled);
my %arguments = $r->args;





--
 Jason Murphy
 System Administrator
 Lawinfo.com
 1-800-397-3743 ex: 133



Re: $r->args()

2001-08-29 Thread Robert Landrum

At 9:36 AM -0700 8/29/01, Rasoul Hajikhani wrote:
>Hello,
>I already have asked this question and got an answer for it, so please
>accept my forwarded apologies. However, I was trying something else and
>got stuck. I know in order to pass around query string, or form data,
>pnotes may be used. However, I am trying something else and it does not
>seem to work!
>
>   $r = Apache::Request->new($r);
>   # check for some condition
>   if ($condition)
>   {
>   my $previous_uri= $r->param('previous_uri');
>
>my $content = $r->param();
>
>$r->method_number(M_GET);
>$r->method('GET');
>
>$r->headers_in->unset("Content-length");
>
>$r->args($content);
>
>$r->internal_redirect("$previous_uri");
>   }


So your goal is to turn a post request into a get request using an 
internal redirect.




>However, in my called handler, no Post data can be read. Can any one
>tell me why is that?
>Any comments welcomed...



param does not work like args, and $content in this example will 
return the number of param keys (IIRC).

I think you want

my $content = join('&',map{$_."=".$r->param($_)}($r->param));

Which should solve your problems (I think).

Rob




--
"A good magician never reveals his secret; the unbelievable trick
becomes simple and obvious once it is explained. So too with UNIX." 



Re: $r->args()

2001-08-29 Thread Rasoul Hajikhani

Robert Landrum wrote:
> 
> At 9:36 AM -0700 8/29/01, Rasoul Hajikhani wrote:
> >Hello,
> >I already have asked this question and got an answer for it, so please
> >accept my forwarded apologies. However, I was trying something else and
> >got stuck. I know in order to pass around query string, or form data,
> >pnotes may be used. However, I am trying something else and it does not
> >seem to work!
> >
> >   $r = Apache::Request->new($r);
> >   # check for some condition
> >   if ($condition)
> >   {
> >   my $previous_uri= $r->param('previous_uri');
> >
> >my $content = $r->param();
> >
> >$r->method_number(M_GET);
> >$r->method('GET');
> >
> >$r->headers_in->unset("Content-length");
> >
> >$r->args($content);
> >
> >$r->internal_redirect("$previous_uri");
> >   }
> 
> So your goal is to turn a post request into a get request using an
> internal redirect.
> 
> >However, in my called handler, no Post data can be read. Can any one
> >tell me why is that?
> >Any comments welcomed...
> 
> param does not work like args, and $content in this example will
> return the number of param keys (IIRC).
> 
> I think you want
> 
> my $content = join('&',map{$_."=".$r->param($_)}($r->param));
> 
> Which should solve your problems (I think).

I am affraid it did not work. I have no problem reading the data in the
current handler, but right after redirect, which is also required to
read the data, I loose all the POSTED data.
> 
> Rob
> 
> --
> "A good magician never reveals his secret; the unbelievable trick
> becomes simple and obvious once it is explained. So too with UNIX."



Re: $r->args()

2001-08-29 Thread Robert Landrum

> > Which should solve your problems (I think).
>
>I am affraid it did not work. I have no problem reading the data in the
>current handler, but right after redirect, which is also required to
>read the data, I loose all the POSTED data.

Performing a redirect causes posted data to be discarded.  Your goal 
should be to convert all of your posted data so that it can be passed 
via GET.

Rob


--
"A good magician never reveals his secret; the unbelievable trick
becomes simple and obvious once it is explained. So too with UNIX." 



Re: $r->args()

2001-08-29 Thread Tom Servo

Once you change the method to GET and put the content in with $r->args();,
it becomes GET data from the query_string.   All the POST data is lost
when you call content(), so you can no longer read it as POST data with
$r->content() again.


Brian Nilsen
[EMAIL PROTECTED]

On Wed, 29 Aug 2001, Rasoul Hajikhani wrote:

> Robert Landrum wrote:
> > 
> > At 9:36 AM -0700 8/29/01, Rasoul Hajikhani wrote:
> > >Hello,
> > >I already have asked this question and got an answer for it, so please
> > >accept my forwarded apologies. However, I was trying something else and
> > >got stuck. I know in order to pass around query string, or form data,
> > >pnotes may be used. However, I am trying something else and it does not
> > >seem to work!
> > >
> > >   $r = Apache::Request->new($r);
> > >   # check for some condition
> > >   if ($condition)
> > >   {
> > >   my $previous_uri= $r->param('previous_uri');
> > >
> > >my $content = $r->param();
> > >
> > >    $r->method_number(M_GET);
> > >$r->method('GET');
> > >
> > >$r->headers_in->unset("Content-length");
> > >
> > >$r->args($content);
> > >
> > >$r->internal_redirect("$previous_uri");
> > >   }
> > 
> > So your goal is to turn a post request into a get request using an
> > internal redirect.
> > 
> > >However, in my called handler, no Post data can be read. Can any one
> > >tell me why is that?
> > >Any comments welcomed...
> > 
> > param does not work like args, and $content in this example will
> > return the number of param keys (IIRC).
> > 
> > I think you want
> > 
> > my $content = join('&',map{$_."=".$r->param($_)}($r->param));
> > 
> > Which should solve your problems (I think).
> 
> I am affraid it did not work. I have no problem reading the data in the
> current handler, but right after redirect, which is also required to
> read the data, I loose all the POSTED data.
> > 
> > Rob
> > 
> > --
> > "A good magician never reveals his secret; the unbelievable trick
> > becomes simple and obvious once it is explained. So too with UNIX."
> 




Re: $r->args()

2001-08-29 Thread Rasoul Hajikhani

Robert Landrum wrote:
> 
> > > Which should solve your problems (I think).
> >
> >I am affraid it did not work. I have no problem reading the data in the
> >current handler, but right after redirect, which is also required to
> >read the data, I loose all the POSTED data.
> 
> Performing a redirect causes posted data to be discarded. 

Did not find that in docs! maybe should pay more attention :(

> Your goal should be to convert 

?? You lost me there... "convert"? convert to what? 

>all of your posted data so that it can be passed via GET.

Would it make any diference if the method, and method_number remained
POST? Does this situation occure as a result of method conversion? (I
will try that)...

-r

PS: Something wrong with the mail server?
> 
> Rob
> 
> --
> "A good magician never reveals his secret; the unbelievable trick
> becomes simple and obvious once it is explained. So too with UNIX."



Re: $r->args()

2001-08-29 Thread Robert Landrum

At 11:19 AM -0700 8/29/01, Rasoul Hajikhani wrote:
>Robert Landrum wrote:
>>
>> > > Which should solve your problems (I think).
>> >
>> >I am affraid it did not work. I have no problem reading the data in the
>> >current handler, but right after redirect, which is also required to
>> >read the data, I loose all the POSTED data.
>>
>> Performing a redirect causes posted data to be discarded.
>
>Did not find that in docs! maybe should pay more attention :(

I'm sure it's in the docs somewhere, but personal experience and 
previous posts to this list have addressed this issue.


> > Your goal should be to convert
>
>?? You lost me there... "convert"? convert to what?

Convert as in from POST request to GET request.

sub escaped {
my $val = shift;
$val =~ s/(\W)/sprintf("%%%.2X",ord($1))/g;
return $val;
}

my $content = join('&',map{$_."=".escaped($r->param($_))}($r->param));

my $internal_url = "/some/path/to/handler?$content";
$r->internal_redirect($internal_url);

>
>>all of your posted data so that it can be passed via GET.
>
>Would it make any diference if the method, and method_number remained
>POST? Does this situation occure as a result of method conversion? (I
>will try that)...

Unlikely.


>
>-r
>
>PS: Something wrong with the mail server?

Uhh... Why?

Rob

--
"A good magician never reveals his secret; the unbelievable trick
becomes simple and obvious once it is explained. So too with UNIX." 



Re: $r->args()

2001-08-29 Thread Ken Williams

[EMAIL PROTECTED] (Rasoul Hajikhani) wrote:

>Robert Landrum wrote:
>> 
>> > > Which should solve your problems (I think).
>> >
>> >I am affraid it did not work. I have no problem reading the data in the
>> >current handler, but right after redirect, which is also required to
>> >read the data, I loose all the POSTED data.
>> 
>> Performing a redirect causes posted data to be discarded. 
>
>Did not find that in docs! maybe should pay more attention :(

You'll find the relevant material in the HTTP/1.1 docs:

  http://www.cis.ohio-state.edu/cgi-bin/rfc/rfc2068.html


  ------
  Ken Williams Last Bastion of Euclidity
  [EMAIL PROTECTED]The Math Forum



Re: $r->args()

2001-08-29 Thread Rasoul Hajikhani

Robert Landrum wrote:
> 
> At 11:19 AM -0700 8/29/01, Rasoul Hajikhani wrote:
> >Robert Landrum wrote:
> >>
> >> > > Which should solve your problems (I think).
> >> >
> >> >I am affraid it did not work. I have no problem reading the data in the
> >> >current handler, but right after redirect, which is also required to
> >> >read the data, I loose all the POSTED data.
> >>
> >> Performing a redirect causes posted data to be discarded.
> >
> >Did not find that in docs! maybe should pay more attention :(
> 
> I'm sure it's in the docs somewhere, but personal experience and
> previous posts to this list have addressed this issue.
> 
> > > Your goal should be to convert
> >
> >?? You lost me there... "convert"? convert to what?
> 
> Convert as in from POST request to GET request.
> 
> sub escaped {
> my $val = shift;
> $val =~ s/(\W)/sprintf("%%%.2X",ord($1))/g;
> return $val;
> }
> 
> my $content = join('&',map{$_."=".escaped($r->param($_))}($r->param));
> 
> my $internal_url = "/some/path/to/handler?$content";
> $r->internal_redirect($internal_url);
> 
> >
> >>all of your posted data so that it can be passed via GET.
> >
> >Would it make any diference if the method, and method_number remained
> >POST? Does this situation occure as a result of method conversion? (I
> >will try that)...
> 
> Unlikely.
> 
> >
> >-r
> >
> >PS: Something wrong with the mail server?
> 
> Uhh... Why?
> 
> Rob
> 
> --
> "A good magician never reveals his secret; the unbelievable trick
> becomes simple and obvious once it is explained. So too with UNIX."

Thanks... It now works...
-r



Re: $r->args()

2001-08-30 Thread princepawn

Robert Landrum writes:
 > sub escaped {
 >  my $val = shift;
 >  $val =~ s/(\W)/sprintf("%%%.2X",ord($1))/g;
 >  return $val;
 > }
 > 
 > my $content = join('&',map{$_."=".escaped($r->param($_))}($r->param));
 > 
 > my $internal_url = "/some/path/to/handler?$content";
 > $r->internal_redirect($internal_url);
 > 

Isn't it considered good practice to use Apache::Util::escape_uri() on
the constructed URI or URI::Escape::uri_escape() instead of writing
one's one character escaping routines? For one, it should be faster,
especially the Apache::Util method as it is written in C. 



$r->args missing data

1999-12-02 Thread Christian Gilmore

We just updgraded from apache-1.3.3/mod_perl-1.16 to
apache-1.3.9/mod_perl-1.21 on solaris-2.5.1. $r->args does not contain any
data for us now when it did before during the URI translation phase.

We're running a minimal system, so many modules have been stripped from the
build (included is one home-grown module mod_pushweb which does no
modification whatsoever of request_rec). We put in some extra debug lines into
both apache's httpd_main.c and mod_perl's mod_perl.c.

It appears that both apache and mod_perl internally have r->args correct, yet
it doesn't make it up to the TransTest module. This same TransHandler code
worked just fine in the previous 1.3.3/1.21 build. Can anyone see the problem?

Included below are:

 * build commands we used
 * httpd.conf snippets relating to mod_perl
 * the TransTest module which demonstrates the problem
 * the error_log

The build commands for mod_perl:
 perl Makefile.PL USE_APACI=1 PERL_TRANS=1 PERL_STACKED_HANDLERS=1
 (answer 'y' to the first question, 'n' to the second)
 make all
 make install

The build commands for apache:

 configure
--disable-module=actions \
--disable-module=alias --disable-module=asis \
--disable-module=auth --disable-module=autoindex \
--disable-module=cgi --disable-module=dir \
--disable-module=env --disable-module=imap \
--disable-module=include --disable-module=mime \
--disable-module=negotiation --disable-module=setenvif \
--disable-module=status --disable-module=userdir \
--activate-module=src/modules/mod_pushweb/libmod_pushweb.a \
--activate-module=src/modules/perl/libperl.a \
--enable-module=apache_ssl
 make

>From httpd.conf:

 PerlRequire /weblab/services/pushweb/lib/TransTest.pm
 PerlTransHandler TransTest

The module:

 package TransTest;
 use lib qw(/weblab/services/pushweb/lib);
 use strict;
 use Apache::Constants ':common';
 use Apache::Log;

 sub handler {
   my($r) = @_;
   $r->handler("perl-script");
   $r->push_handlers(PerlHandler => \&transtest_handler);
   return OK;
 }

 sub transtest_handler {
   my($r) = @_;
   my $log = $r->server->log;

   $log->debug("TransTest Handler entry");

   $log->debug("The Entire Request: " . $r->as_string);
   $log->debug("The Request Line: " . $r->the_request);
   $log->debug("The Path Information: " . $r->uri);
   $log->debug("The Args: " . $r->args);

   my $response = "TransTest ";
   $response .= "response\n";

   $r->no_cache(1);
   # Apache's no-caching (as of 1.3.0) is broken.
   # It just modifies stamp
   $r->header_out('Pragma', 'no-cache');
   $r->header_out('Cache-control', 'no-cache');
   $r->header_out('Content-Length', length($response));
   $r->send_http_header();
   $r->print($response);

   $log->debug("TransTest Handler exit");
 }


 1;

 __END__

>From the error_log:

[Thu Dec  2 17:07:08 1999] [notice] Apache/1.3.9 Ben-SSL/1.37 (Unix)
mod_perl/1.21 configured -- resuming normal operations
[Thu Dec  2 17:07:08 1999] [info] Server built: Dec  1 1999 19:11:25
[Thu Dec  2 17:07:21 1999] [debug] apache_ssl.c(1718): CIPHER is RC4-MD5
[Thu Dec  2 17:07:21 1999] [debug] buff.c(263): read returned 310 rwstate=3
state=3 rstate=240 cren=0 aren=0 accept=1
[Thu Dec  2 17:07:21 1999] [error] [client 135.207.24.19] before ap_parse_uri
[Thu Dec  2 17:07:21 1999] [error] [client 135.207.24.19] after ap_parse_uri
args=foo=bar
[Thu Dec  2 17:07:21 1999] [debug] mod_perl.c(884): before callup to
perltranshandler, args=foo=bar
[Thu Dec  2 17:07:21 1999] [debug] mod_perl.c(887): after callup to
perltranshandler, args=foo=bar
[Thu Dec  2 17:07:21 1999] [debug]
/weblab/services/pushweb/lib/TransTest.pm(18): TransTest Handler entry
[Thu Dec  2 17:07:21 1999] [debug]
/weblab/services/pushweb/lib/TransTest.pm(20): The Entire Request: GET
/login=cgilmore/?foo=bar HTTP/1.0
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*
Accept-Charset: iso-8859-1,*,utf-8
Accept-Encoding: gzip
Accept-Language: en
Connection: Keep-Alive
Host: absent.research.att.com
User-Agent: Mozilla/4.61 [en] (X11; U; SunOS 5.7 sun4u)

HTTP/1.0 (null)


[Thu Dec  2 17:07:21 1999] [debug]
/weblab/services/pushweb/lib/TransTest.pm(21): The Request Line: GET
/login=cgilmore/?foo=bar HTTP/1.0
[Thu Dec  2 17:07:21 1999] [debug]
/weblab/services/pushweb/lib/TransTest.pm(22): The Path Information:
/login=cgilmore/
[Thu Dec  2 17:07:21 1999] [debug]
/weblab/services/pushweb/lib/TransTest.pm(23): The Args:
[Thu Dec  2 17:07:21 1999] [debug]
/weblab/services/pushweb/lib/TransTest.pm(35): TransTest Handler exit



Thanks,
Christian

-
Christian Gilmore
Senior Technical Staff Member
AT&T Labs IP Technology, Florham Park
[EMAIL PROTECTED]
http://www.research.att.com/info/cgilmore



RE: $r->args troubles...

2000-04-07 Thread Geoffrey Young

you are calling Apache::Request->new incorrectly - see the docs :)

> -Original Message-
> From: Jason Murphy [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 07, 2000 2:07 PM
> To: [EMAIL PROTECTED]
> Subject: $r->args troubles...
> 
> 
> Dear Mod_Perl'lers
> 
> I hate to bug the list with this simple problem, but I am at 
> my wits end. I
> have The Good Book (Aka: Apache Modules with Perl and C. Aka: 
> The Eagle
> Book) but have some questions that are just killing me.
> 
> I would like to do something like the program on page 104 - 
> 110 and also
> page 130 - 135 of The Eagle book. For those of you not 
> blessed with this
> book, I am trying to recover the parameter from a GET 
> request. Below is my
> code I correctly using, but my problem is the Apache::Request and
> Apache::Constant are not being found or used or whatever is 
> the error (Error
> posted below).
> 
> Some notes, I have tried adding "use Apache::Constants 
> qw(:common)" but it
> also returns the same error. I have also replaced the last 
> line with "my
> ($FirstInfo, $SecondInfo) = split /=/, $r->args;" with no 
> success either. I
> have those modules installed, and I forced reinstalled them 
> to make sure
> along with Bundle::Apache.
> 
> If anyone could point me to a really good example of the 
> r->args and GET
> requests I would really appreciate it.
> 
> <---My Error--->
> 
> Can't locate object method "new" via package "Apache::Request" at
> ../find_player.pl line 10.
> 
> 
> 
> <---MY CODE--->
> 
> use strict;
> 
> use Apache::Request ();
> use CGI qw(:standard);
> use DBI;
> 
> my $r = new Apache::Request;  <---Where the error appears
> my $dbh ||= DBI->connect('dbi:mysql:Action', 'login', 
> 'password') || die
> "Could not open Database: ";
> 
> my ($person_id, $name, $totalkills, $totalkilled);
> my %arguments = $r->args;
> 
> 
> 
> 
> 
> --
>  Jason Murphy
>  System Administrator
>  Lawinfo.com
>  1-800-397-3743 ex: 133
> 



Re: $r->args troubles...

2000-04-07 Thread Doug Kyle

It goes like this:

my $r = Apache->request;
my $apr = Apache::Request->new($r);

--
Doug Kyle - Information Systems
Grand Rapids Public Library
"We're superheros man, we don't have time to be charming . . . we're public
servants, not glamour boys" - The Tick.


Jason Murphy wrote:

> Dear Mod_Perl'lers
>
> I hate to bug the list with this simple problem, but I am at my wits end. I
> have The Good Book (Aka: Apache Modules with Perl and C. Aka: The Eagle
> Book) but have some questions that are just killing me.
>
> I would like to do something like the program on page 104 - 110 and also
> page 130 - 135 of The Eagle book. For those of you not blessed with this
> book, I am trying to recover the parameter from a GET request. Below is my
> code I correctly using, but my problem is the Apache::Request and
> Apache::Constant are not being found or used or whatever is the error (Error
> posted below).
>
> Some notes, I have tried adding "use Apache::Constants qw(:common)" but it
> also returns the same error. I have also replaced the last line with "my
> ($FirstInfo, $SecondInfo) = split /=/, $r->args;" with no success either. I
> have those modules installed, and I forced reinstalled them to make sure
> along with Bundle::Apache.
>
> If anyone could point me to a really good example of the r->args and GET
> requests I would really appreciate it.
>
> <---My Error--->
>
> Can't locate object method "new" via package "Apache::Request" at
> ./find_player.pl line 10.
>
> <---MY CODE--->
>
> use strict;
>
> use Apache::Request ();
> use CGI qw(:standard);
> use DBI;
>
> my $r = new Apache::Request;  <---Where the error appears
> my $dbh ||= DBI->connect('dbi:mysql:Action', 'login', 'password') || die
> "Could not open Database: ";
>
> my ($person_id, $name, $totalkills, $totalkilled);
> my %arguments = $r->args;
>
> --
>  Jason Murphy
>  System Administrator
>  Lawinfo.com
>  1-800-397-3743 ex: 133




Re: $r->args troubles...

2000-04-11 Thread Doug MacEachern

On Fri, 7 Apr 2000, Jason Murphy wrote:
> Can't locate object method "new" via package "Apache::Request" at
> ./find_player.pl line 10.

that would normally indicate your script is running under mod_cgi, not
mod_perl.
 
> my $r = new Apache::Request;  <---Where the error appears

in any case, you need to change that to:

my $r = Apache::Request->new(shift);
or
my $r = Apache::Request->new(Apache->request);





Re: $r->args troubles...

2000-04-12 Thread Jason Murphy


You would have guessed right. However, the problem was two fold in my case.

First, I was not calling Apache::Request correctly. The proper method to
call Apache was told to me by Doug Kyle (Giving credit where due!). Below is
how it is done.

<--- Begin Example

my $r = Apache->request;
my $apr = Apache::Request->new($r);

my %params = $apr->args;

print $params{"Player"};

< End Example

The 'print $params{"Player"}' would be used to get and print something like
the parameters from the URL of a GET like
"www.example.com/find_player.pl?Player=Mullen" (Not a real site, dont
click!).

Second part of my problem was that I had an error in my Apache::Registry
setup in Apache.conf or perl.conf (Can't remember where I put it). The
script I was running was not being picked up by Apache::Registry and thus
not working.

 Thanks for everyone's help.

PS. The only reason I say this on the mailing list is to get it in to the
mailing list archives because I could not my solution there when I looked.


From: "Doug MacEachern" <[EMAIL PROTECTED]>
To: "Jason Murphy" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, April 11, 2000 8:52 PM
Subject: Re: $r->args troubles...

> On Fri, 7 Apr 2000, Jason Murphy wrote:
> > Can't locate object method "new" via package "Apache::Request" at
> > ./find_player.pl line 10.
>
> that would normally indicate your script is running under mod_cgi, not
> mod_perl.
>
> > my $r = new Apache::Request;  <---Where the error appears
>
> in any case, you need to change that to:
>
> my $r = Apache::Request->new(shift);
> or
> my $r = Apache::Request->new(Apache->request);
>
>

--
 Jason Murphy
 System Administrator
 Lawinfo.com
 1-800-397-3743 ex: 133






$r->args vs $r->content

2002-05-13 Thread Mike Melillo


Hi,

I'm having issues processing user input via POST requests.  I have a
simple form page, that when you click submit I just want to redisplay
the page but with the values filled in. If I do a GET request and do
%params = $r->args;

It works, but if I use the method in the eagle book for POST requests
%params = $r->content; then nothing gets returned.  I've even printed
%params to the apache errlog with DataDumper, and its empty.  

One of the fields is an image file that will be uploaded so I need to
use POST requests.  Is this a job for Apache::Request?  The eagle book
doesn't cover it much because it was "experimental" at the time of
publishing.

Thanks,

Mike




$r->args vs $r->content

2002-05-14 Thread Mike Melillo








 

 

 

Ok, I've switched to A::Request,
but it still seems my parameters table is empty.  I'll paste in the form data,
as well as some code snippets to see if that helps find the bug.

 

 

 

username

 

 

password



 



 



 

**End HTML Template**

 

** Join.pm **

 

sub submit {

    my $DEBUG = 1;

    my ($r) = shift;

    my $apr = Apache::Request->new($r);

    my $status = $apr->parse;

    my @param = $apr->param;

    $DEBUG &&
print STDERR Dumper($apr->parms)

    $DEBUG &&
print STDERR Dumper(@param);

 

...

}

 

 

The first Data::Dumper print
statement sends this to the errlog -> 

$VAR1 = bless( {}, 'Apache::Table'
);

 

The second print statement
prints nothing.

 

I looked at perldoc Apache::Request,
but didn’t see anything wrong...

 

Help?

 

Mike

 

 

 

-Original Message-

From: Issac Goldstand [mailto:[EMAIL PROTECTED]] 

Sent: Tuesday, May 14, 2002
4:39 AM

To: Mike Melillo

Cc: [EMAIL PROTECTED]

Subject: Re: $r->args vs
$r->content

 

Quoting Mike Melillo
<[EMAIL PROTECTED]>:

 

> 

> Hi,

> 

 

> One of the fields is an
image file that will be uploaded so I need to 

> use POST requests.  Is
this a job for Apache::Request?  The eagle book 

> doesn't cover it much
because it was "experimental" at the time of 

> publishing.

> 

There's a version 1.0 out by
now.  That means stable as it's ever gonna get :-)  I use it all the time, go
for it!

 

  Issac

 

 

Internet is a wonderful
mechanism for making a fool of

yourself in front of a very
large audience.

  --Anonymous

 

Moving the mouse won\'t get
you into trouble...  Clicking it might.

  --Anonymous

 

PGP Key 0xE0FA561B -
Fingerprint:

7E18 C018 D623 A57B 7F37
D902 8C84 7675 E0FA 561B

 

 








Re: $r->args missing data

1999-12-02 Thread Ken Y. Clark

On Thu, 2 Dec 1999, Christian Gilmore wrote:

> We just updgraded from apache-1.3.3/mod_perl-1.16 to
> apache-1.3.9/mod_perl-1.21 on solaris-2.5.1. $r->args does not contain any
> data for us now when it did before during the URI translation phase.

[ snip ]

> The module:
> 
>  package TransTest;
>  use lib qw(/weblab/services/pushweb/lib);
>  use strict;
>  use Apache::Constants ':common';
>  use Apache::Log;
> 
>  sub handler {
>my($r) = @_;
>$r->handler("perl-script");
>$r->push_handlers(PerlHandler => \&transtest_handler);
>return OK;
>  }
> 
>  sub transtest_handler {
>my($r) = @_;
>my $log = $r->server->log;
> 
>$log->debug("TransTest Handler entry");
> 
>$log->debug("The Entire Request: " . $r->as_string);
>    $log->debug("The Request Line: " . $r->the_request);
>$log->debug("The Path Information: " . $r->uri);
>$log->debug("The Args: " . $r->args);
> 
>my $response = "TransTest ";
>$response .= "response\n";
> 
>$r->no_cache(1);
># Apache's no-caching (as of 1.3.0) is broken.
># It just modifies stamp
>$r->header_out('Pragma', 'no-cache');
>$r->header_out('Cache-control', 'no-cache');
>$r->header_out('Content-Length', length($response));
>$r->send_http_header();
>$r->print($response);
> 
>$log->debug("TransTest Handler exit");
>  }

you might try referencing $r->main->args because you are passing $r to
your trastest_handler.  this has been a consistent thorn in my side for
many applications.  sometimes $r->main->args has it, sometimes $r->args,
and sometimes i can successfully use a CGI query object and get it from
$q->param.

hth,

ky



Re: $r->args vs $r->content

2002-05-13 Thread Todd Finney

At 10:29 PM 5/13/02, Mike Melillo wrote:
>It works, but if I use the method in the eagle book for POST requests
>%params = $r->content; then nothing gets returned.  I've even printed
>%params to the apache errlog with DataDumper, and its empty.
>
>One of the fields is an image file that will be uploaded so I need to
>use POST requests.  Is this a job for Apache::Request?  The eagle book
>doesn't cover it much because it was "experimental" at the time of
>publishing.

Does your FORM tag specify enctype="application/x-www-urlencoded"?

cheers,
Todd




RE: $r->args vs $r->content

2002-05-13 Thread Mike Melillo


No, It specifies multipart/form-data because page 131 of the eagle says
its used for file uploads.

Mike 

-Original Message-
From: Todd Finney [mailto:[EMAIL PROTECTED]] 
Sent: Monday, May 13, 2002 11:16 PM
To: [EMAIL PROTECTED]
Subject: Re: $r->args vs $r->content

At 10:29 PM 5/13/02, Mike Melillo wrote:
>It works, but if I use the method in the eagle book for POST requests
>%params = $r->content; then nothing gets returned.  I've even printed
>%params to the apache errlog with DataDumper, and its empty.
>
>One of the fields is an image file that will be uploaded so I need to
>use POST requests.  Is this a job for Apache::Request?  The eagle book
>doesn't cover it much because it was "experimental" at the time of
>publishing.

Does your FORM tag specify enctype="application/x-www-urlencoded"?

cheers,
Todd




RE: $r->args vs $r->content

2002-05-13 Thread Todd Finney

Yup, slight memory error when responding, sorry :)

$r->content is going to be empty if you're not using the 
application/x-www-form-urlencoded, perldoc Apache.

Page 131 of the Eagle book also says

"If the browser uses the newer multiport/form-data encoding (which is 
used for  file uploads, among other things), then mod_perl users will 
have to read and parse the content information themselves."

You need to use Apache::Request, or CGI.pm to do a file upload.  It's 
not going to work otherwise.   I've never had a problem with A::Request 
in production use; I don't think it's considered experimental any 
more.

cheers,
Todd

At 11:49 PM 5/13/02, Mike Melillo wrote:

>No, It specifies multipart/form-data because page 131 of the eagle 
>says
>its used for file uploads.
>
>Mike
>
>-Original Message-
>From: Todd Finney [mailto:[EMAIL PROTECTED]]
>Sent: Monday, May 13, 2002 11:16 PM
>To: [EMAIL PROTECTED]
>Subject: Re: $r->args vs $r->content
>
>At 10:29 PM 5/13/02, Mike Melillo wrote:
> >It works, but if I use the method in the eagle book for POST 
> requests
> >%params = $r->content; then nothing gets returned.  I've even 
> printed
> >%params to the apache errlog with DataDumper, and its empty.
> >
> >One of the fields is an image file that will be uploaded so I need 
> to
> >use POST requests.  Is this a job for Apache::Request?  The eagle 
> book
> >doesn't cover it much because it was "experimental" at the time of
> >publishing.
>
>Does your FORM tag specify enctype="application/x-www-urlencoded"?
>
>cheers,
>Todd




Re: $r->args vs $r->content

2002-05-14 Thread Issac Goldstand

Quoting Mike Melillo <[EMAIL PROTECTED]>:

> 
> Hi,
> 

> One of the fields is an image file that will be uploaded so I need to
> use POST requests.  Is this a job for Apache::Request?  The eagle book
> doesn't cover it much because it was "experimental" at the time of
> publishing.
> 
There's a version 1.0 out by now.  That means stable as it's ever gonna get :-)
 I use it all the time, go for it!

  Issac


Internet is a wonderful mechanism for making a fool of
yourself in front of a very large audience.
  --Anonymous

Moving the mouse won\'t get you into trouble...  Clicking it might.
  --Anonymous

PGP Key 0xE0FA561B - Fingerprint:
7E18 C018 D623 A57B 7F37 D902 8C84 7675 E0FA 561B



Re: $r->args vs $r->content

2002-05-14 Thread Richard Clarke

Are you also processing the posted data at some earlier request stage? It
doesn't sound like you would be but I thought I would ask.

Richard


- Original Message -
From: Mike Melillo
To: [EMAIL PROTECTED]
Sent: Tuesday, May 14, 2002 5:22 PM
Subject: $r->args vs $r->content





Ok, I've switched to A::Request, but it still seems my parameters table is
empty.  I'll paste in the form data, as well as some code snippets to see if
that helps find the bug.

 

username



password






**End HTML Template**

** Join.pm **

sub submit {
my $DEBUG = 1;
my ($r) = shift;
my $apr = Apache::Request->new($r);
my $status = $apr->parse;
my @param = $apr->param;
$DEBUG && print STDERR Dumper($apr->parms)
$DEBUG && print STDERR Dumper(@param);

...
}


The first Data::Dumper print statement sends this to the errlog ->
$VAR1 = bless( {}, 'Apache::Table' );

The second print statement prints nothing.

I looked at perldoc Apache::Request, but didn't see anything wrong...

Help?

Mike



-Original Message-
From: Issac Goldstand [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 14, 2002 4:39 AM
To: Mike Melillo
Cc: [EMAIL PROTECTED]
Subject: Re: $r->args vs $r->content

Quoting Mike Melillo <[EMAIL PROTECTED]>:

>
> Hi,
>

> One of the fields is an image file that will be uploaded so I need to
> use POST requests.  Is this a job for Apache::Request?  The eagle book
> doesn't cover it much because it was "experimental" at the time of
> publishing.
>
There's a version 1.0 out by now.  That means stable as it's ever gonna get
:-)  I use it all the time, go for it!

  Issac


Internet is a wonderful mechanism for making a fool of
yourself in front of a very large audience.
  --Anonymous

Moving the mouse won\'t get you into trouble...  Clicking it might.
  --Anonymous

PGP Key 0xE0FA561B - Fingerprint:
7E18 C018 D623 A57B 7F37 D902 8C84 7675 E0FA 561B