Re: self_url MP2 w/o CGI

2003-09-02 Thread Stas Bekman
[please keep the thread on the list!]

Tofu Optimist wrote:
:(

[Tue Sep 02 15:22:53 2003] [error] [client
192.168.1.2] Can't locate object method
"construct_url" via package "Apache::RequestRec" at
/home//mod-perl/Redirect.pm line 59.
Do I need to load it or something?
in mp2 you need to load modules that contain the methods that you want to use:

% lookup construct_url
To use method 'construct_url' add:
use Apache::URI ();
See:
http://perl.apache.org/docs/2.0/user/porting/porting.html#Porting_a_Perl_Module_to_Run_under_mod_perl_2_0

You just call $r->construct_url. In your example
that would be:
   $r->headers_out->set(Location =>
$r->construct_url . "&r2=1");

__

Stas BekmanJAm_pH --> Just Another
mod_perl Hacker
http://stason.org/ mod_perl Guide --->
http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org
http://apacheweek.com
http://modperlbook.org http://apache.org  
http://ticketmaster.com



--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info:
http://perl.apache.org/maillist/modperl.html


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


--

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: self_url MP2 w/o CGI

2003-09-02 Thread Stas Bekman
Tofu Optimist wrote:
Thanks.  How do I call construct_uri?
You just call $r->construct_url. In your example that would be:

   $r->headers_out->set(Location => $r->construct_url . "&r2=1");

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: self_url MP2 w/o CGI

2003-09-02 Thread Tofu Optimist
Thanks.  How do I call construct_uri?

Neither

my $uri = APR::URI->parse($r->pool,
$r->construct_url($r->pool, $r->uri, $r));
   $uri .= "r2=1";
$r->headers_out->set(Location => $uri .
"&r2=1");
return Apache::REDIRECT;


nor

my $uri = APR::URI->parse($r->pool,
$r->construct_url);
   $uri .= "r2=1";
$r->headers_out->set(Location => $uri .
"&r2=1");
return Apache::REDIRECT;

works.

Thanks Stas for all your patience and help!



--- Stas Bekman <[EMAIL PROTECTED]> wrote:
> Tofu Optimist wrote:
> > Hi folks --
> > 
> > I'm using MP2, and I am trying to avoid loading
> CGI
> > for 2 reasons: 
> > 
> > (1) To save memory. 
> > 
> > (2) When I do load CGI, it fails at the "require
> > Apache" (line 161), and I'd prefer not to edit CGI
> on
> > my server.  Uck.
> > 
> > Given I'm not loading CGI, how can I determine
> > self_url() in MP2?
> > 
> > I tried something like this
> > 
> > my $self_uri = APR::URI->parse($r->pool,
> > $r->uri)->unparse;
> > $r->headers_out->set(Location => $self_uri
> .
> > "&r2=1");
> > return Apache::REDIRECT;
> > 
> > but this gives me a partial URL, not the full
> > expansion.
> 
> $r->construct_url;
> 
>  From the C docs:
> 
> /* Used for constructing self-referencing URLs, and
> things like SERVER_PORT,
>   * and SERVER_NAME.
>   */
> /**
>   * build a fully qualified URL from the uri and
> information in the request rec
>   * @param p The pool to allocate the URL from
>   * @param uri The path to the requested file
>   * @param r The current request
>   * @return A fully qualified URL
>   * @deffunc char *ap_construct_url(apr_pool_t *p,
> const char *uri, 
> request_rec *r)
>   */
> AP_DECLARE(char *) ap_construct_url(apr_pool_t *p,
> const char *uri, 
> request_rec *r);
> 
>
__
> Stas BekmanJAm_pH --> Just Another
> mod_perl Hacker
> http://stason.org/ mod_perl Guide --->
> http://perl.apache.org
> mailto:[EMAIL PROTECTED] http://use.perl.org
> http://apacheweek.com
> http://modperlbook.org http://apache.org  
> http://ticketmaster.com
> 
> 
> 
> -- 
> Reporting bugs: http://perl.apache.org/bugs/
> Mail list info:
> http://perl.apache.org/maillist/modperl.html
> 


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: self_url MP2 w/o CGI

2003-09-02 Thread Stas Bekman
Tofu Optimist wrote:
Hi folks --

I'm using MP2, and I am trying to avoid loading CGI
for 2 reasons: 

(1) To save memory. 

(2) When I do load CGI, it fails at the "require
Apache" (line 161), and I'd prefer not to edit CGI on
my server.  Uck.
Given I'm not loading CGI, how can I determine
self_url() in MP2?
I tried something like this

my $self_uri = APR::URI->parse($r->pool,
$r->uri)->unparse;
$r->headers_out->set(Location => $self_uri .
"&r2=1");
return Apache::REDIRECT;

but this gives me a partial URL, not the full
expansion.
$r->construct_url;

From the C docs:

/* Used for constructing self-referencing URLs, and things like SERVER_PORT,
 * and SERVER_NAME.
 */
/**
 * build a fully qualified URL from the uri and information in the request rec
 * @param p The pool to allocate the URL from
 * @param uri The path to the requested file
 * @param r The current request
 * @return A fully qualified URL
 * @deffunc char *ap_construct_url(apr_pool_t *p, const char *uri, 
request_rec *r)
 */
AP_DECLARE(char *) ap_construct_url(apr_pool_t *p, const char *uri, 
request_rec *r);

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


self_url MP2 w/o CGI

2003-09-02 Thread Tofu Optimist
Hi folks --

I'm using MP2, and I am trying to avoid loading CGI
for 2 reasons: 

(1) To save memory. 

(2) When I do load CGI, it fails at the "require
Apache" (line 161), and I'd prefer not to edit CGI on
my server.  Uck.

Given I'm not loading CGI, how can I determine
self_url() in MP2?

I tried something like this

my $self_uri = APR::URI->parse($r->pool,
$r->uri)->unparse;
$r->headers_out->set(Location => $self_uri .
"&r2=1");
return Apache::REDIRECT;

but this gives me a partial URL, not the full
expansion.

Thanks for any assistance.

-TO


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html