[prev] [thread] [next] [Date index for 2004/11/05]
THanks. All suggestions works well. Stas Bekman wrote: > Ruslan U. Zakirov wrote: > >> Hello. >> 1) I can't find how to get string that represent initial request >> location. I mean 'http://www.example.com/foo...'. Is it possible? Now, >> I use next code as workaround: >> my $location = $r->dir_config( 'ServerName' ); >> unless( $location ) { >> $location = 'http://'. join ':', $r->get_server_name, >> $r->get_server_port; >> } > > > better: > > $location = 'http://' . $r->construct_server; > > http://perl.apache.org/docs/2.0/api/Apache/URI.html#C_construct_server_ > > but your code doesn't include the URI. > > my $uri = $r->parsed_uri->unparse; > > But really what you are after is: $r->construct_url(); > http://perl.apache.org/docs/2.0/api/Apache/URI.html#C_construct_url_ > >> 2) Can I get name of the current mod_perl hook. My module works well >> as PerlTransHandler or other that executes later, but should return OK >> if it's translating handler and DECLINED in other cases. I wish to >> write something like next code: >> if( $r->foo_method eq 'PerlTransHandler' ) { >> return OK; >> } else { >> return DECLINED >> } > > > my $callback = ModPerl::Util::current_callback(); > http://perl.apache.org/docs/2.0/api/ModPerl/Util.html#C_current_callback_ > >> 3) I have two configuration variables in httpd.conf: >> PerlSetVar StorageRoot /mnt/local/storage/music/ >> PerlSetVar BaseLocation /download >> Can I declare 'Alias BaseLocation StorageRoot' with mod_perl API? >> Without this alias Apache can't find file and I don't want to force >> user to input same strings twice. > > > There is no direct API (is there a C API for that? if there is we can > add the perl glue), but you can always push httpd.conf text with: > $r->add_config() > http://perl.apache.org/docs/2.0/api/Apache/RequestUtil.html#C_add_config_ > or $s->add_config() > http://perl.apache.org/docs/2.0/api/Apache/ServerUtil.html#C_add_config_ > > -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
[mp2] API questions. Ruslan U. Zakirov 17:19 on 04 Nov 2004
Re: [mp2] API questions. Stas Bekman 22:49 on 04 Nov 2004
Re: [mp2] API questions. Ruslan U. Zakirov 10:46 on 05 Nov 2004
Generated at 11:26 on 21 Dec 2004 by mariachi v0.52