[mp2] Perl Sections, Method handlers

2003-01-27 Thread Randy J. Ray
Any indication of when/if these features will make it to mp2? I've been trying 
to get my RPC::XML code (specifically the Apache::RPC::Server and 
Apache::RPC::Status modules) to work under Apache2 and mod_perl2 (thanks to 
Red Hat for pushing up my timetable on this by installing those).

Randy
--
---
Randy J. Ray | Men occasionally stumble over the truth, but most of them
[EMAIL PROTECTED] | pick themselves up and hurry off as if nothing had happened.
+1 650 930-9097  |   -- Sir Winston Churchill


Re: [mp2] Perl Sections, Method handlers

2003-01-27 Thread Stas Bekman
Randy J. Ray wrote:

Any indication of when/if these features will make it to mp2? I've been 
trying to get my RPC::XML code (specifically the Apache::RPC::Server and 
Apache::RPC::Status modules) to work under Apache2 and mod_perl2 (thanks 
to Red Hat for pushing up my timetable on this by installing those).

I guess Philippe can comment on the Perl  sections part, I think it should 
be in RSN. What about method handlers? What's wrong with them?

__
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



Re: [mp2] Perl Sections, Method handlers

2003-01-27 Thread Stas Bekman
[please always reply to the list! thank you!]

Randy J. Ray wrote:

I guess Philippe can comment on the Perl  sections part, I think it 
should be in RSN. What about method handlers? What's wrong with them?


Only that my handlers, both prototyped as ($$), received only the 
request object (Apache::RequestRec reference) in their arg list, rather 
than getting the class as the first argument. Of course, the intent 
behind having the server classes be method-handlers is to assign the the 
server object as the handler directly, but that requires the Perl 
section support.

Which makes me think-- I always found it odd in mp1 that assigning an 
object as a location-handler required a frozen reference of sorts-- 
'$obj' vs. simple $obj. The latter seems so much more intuitive. Is this 
changing for mp2?

See:
http://perl.apache.org/docs/2.0/user/compat/compat.html#Method_Handlers




__
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




SOLVED: How to access base environment from Perl sections

2002-08-15 Thread Tom Mornini

Perhaps it's obvious but after years of mod_perl, I was blocked, 
probably because using this basic Perl ability is frowned upon in 
mod_perl due to performance issues. Of course, during startup, 
performance isn't an issue. :-)

In my case, I wanted to PerlPassEnv all environment variables that began 
with EWINGZ_

Perl
   for ( grep { /^EWINGZ_/ } `env` ) {
 my ($key) = /^([^=]+)/;
 push PerlPassEnv,$key;
   }
/Perl

Stas: I asked this question almost exactly a year ago and nobody 
answered it. I asked it yesterday, and again nobody answered it. Perhaps 
this should be the Perl Sections section of the guide? After all, the 
guide already mentions something very similar to this.

--
-- Tom Mornini
-- InfoMania Printing and Prepress
--
-- ICQ: 113526784, AOL, Yahoo, MSN and Jabber: tmornini




Re: SOLVED: How to access base environment from Perl sections

2002-08-15 Thread Stas Bekman

Tom Mornini wrote:
 Perhaps it's obvious but after years of mod_perl, I was blocked, 
 probably because using this basic Perl ability is frowned upon in 
 mod_perl due to performance issues. Of course, during startup, 
 performance isn't an issue. :-)
 
 In my case, I wanted to PerlPassEnv all environment variables that began 
 with EWINGZ_
 
 Perl
   for ( grep { /^EWINGZ_/ } `env` ) {
 my ($key) = /^([^=]+)/;
 push @PerlPassEnv,$key;
   }
 /Perl
 
 Stas: I asked this question almost exactly a year ago and nobody 
 answered it. I asked it yesterday, and again nobody answered it. Perhaps 
 this should be the Perl Sections section of the guide? After all, the 
 guide already mentions something very similar to this.


Funny, but there are too many things in the guide to remember. The new
search feature exposes them all, just remember to use it.

I was just about to add your tip, when I've found it
http://perl.apache.org/docs/1.0/guide/porting.html#Passing_ENV_variables_to_CGI
which was added about 3 years ago:
http://perl.apache.org/docs/1.0/guide/Changes.html#05_17_1999_ver_1_11

may be we need to add a xref from the Perl sections section?


__
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




Re: SOLVED: How to access base environment from Perl sections

2002-08-15 Thread Tom Mornini

On Thursday, August 15, 2002, at 07:47 PM, Stas Bekman wrote:

 Tom Mornini wrote:
 Perhaps it's obvious but after years of mod_perl, I was blocked, 
 probably because using this basic Perl ability is frowned upon in 
 mod_perl due to performance issues. Of course, during startup, 
 performance isn't an issue. :-)
 In my case, I wanted to PerlPassEnv all environment variables that 
 began with EWINGZ_
 Perl
   for ( grep { /^EWINGZ_/ } `env` ) {
 my ($key) = /^([^=]+)/;
 push PerlPassEnv,$key;
   }
 /Perl
 Stas: I asked this question almost exactly a year ago and nobody 
 answered it. I asked it yesterday, and again nobody answered it. 
 Perhaps this should be the Perl Sections section of the guide? After 
 all, the guide already mentions something very similar to this.

 Funny, but there are too many things in the guide to remember. The new
 search feature exposes them all, just remember to use it.

 I was just about to add your tip, when I've found it
 http://perl.apache.org/docs/1.0/guide/porting.html#Passing_ENV_variables_to_CGI
 which was added about 3 years ago:
 http://perl.apache.org/docs/1.0/guide/Changes.html#05_17_1999_ver_1_11

 may be we need to add a xref from the Perl sections section?

Yes, that makes sense.

I would NEVER have looked there, as:

1) It wasn't in the Perl or Configuration section
2) I wasn't trying to pass environment variables to CGI scripts. :-)

I'll have to learn to use the search functionality!

I'm not sure if I've said it before, but thanks for doing all that you 
do for the mod_perl community. I appreciate it.

--
-- Tom Mornini
-- InfoMania Printing and Prepress
--
-- ICQ: 113526784, AOL, Yahoo, MSN and Jabber: tmornini




Perl sections and Apache-request-subprocess_env

2002-08-14 Thread Tom Mornini
I'd like to access the original Apache startup environment variables from within Perl> sections.

Through experimentation and reading page 498 of the Eagle that I need to use Apache->Request->subprocess_env to access the original environment in order to do this, as %ENV is cleared at interpreter creation.

However, I cannot figure out how to do this in Perl> sections! Apache->Request returns undef (reasonably so, as there is no current request)

So, the question is this: How to get the equivalent of $r->subprocess_env from within a Perl> section?

-- 
-- Tom Mornini
-- InfoMania Printing  Prepress
--
-- ICQ: 113526784, AOL: tmornini, Yahoo: tmornini, MSN: tmornini

Perl sections

2002-07-08 Thread Mike Blazer

Hi All,

I'm developing a multi-httpd configuration with the http accelerating
proxy, well practically the same that was described in the Apache
mod_perl guide. 2 httpd+mod_perl - one for very fast process with low
need in modules, and the other one for statistics, near 1MB of modules,
much slower in comparence with the 1st one. And the 3rd -
httpd+mod_proxy (or may be mod_accel by Igor Sysoev that I've read about
only yesterday :)

Right now this all happens on one and the same machine with one
ip-address. So, I've got the idea to attach busy mod_perl httpds to some
unusual ports on 127.0.0.1 and make them available from localhost only.
While proxy is supposed to handle 7+ name based virtual hosts (the
number is DB-dependent)

OK, this goes OK so far (cross fingers). Before this poin it worked very
nice on one httpd with the large Perl section that includes DB call to
find out which virtual hosts to initiate. But now with this
httpd+mod_proxy I can't use Perl section because it shouldn't use
mod_perl, right? It's supposed to be lightweight.

Well, the question is, what if I'll load mod_perl only for Perl
section parsing and generating the dynamic config with
Apache-httpd_conf method, and no real mod_perl locations - would this
still make server childs much bigger then without mod_perl?

Sorry, as I'm mainly on Win32 and the production server is now built
statically, I'm a little limited in experiments loading modules. I'd
like to know also would the child-servers size depend on static/DSO
installation of the proxy-httpd with mod_perl (again - to run on server
statup only and parse Perl sections only). May be DSO httpd will load
mod_perl.so on startup and not copy it to child servers as they don't
need it?

Or may be there is some way to un-load mod_perl after Perl sections
processing?

Thanks, any input is much appreciated
-- 
==
Mike Blazer
[EMAIL PROTECTED]
==



Re: Perl sections

2002-07-08 Thread Ilya Martynov

 On Mon, 08 Jul 2002 18:39:04 +0400, Mike Blazer [EMAIL PROTECTED] said:

MB Hi All,

MB [..snip..]

MB Well, the question is, what if I'll load mod_perl only for Perl
MB section parsing and generating the dynamic config with
MB Apache- httpd_conf method, and no real mod_perl locations - would this
MB still make server childs much bigger then without mod_perl?

Yes, it will.

MB [..snip..]

MB Or may be there is some way to un-load mod_perl after Perl sections
MB processing?

If you need Perl sections only to do initial web server
configuration and you do not need mod_perl features in runtime then
instead of using Perl just write Perl script to generate Apache
config file from templates and run it before starting Apache. This way
you do not need mod_perl on frontend Apache at all.

-- 
Ilya Martynov (http://martynov.org/)



Re: Perl sections

2002-07-08 Thread Mike Blazer

 MB Or may be there is some way to un-load mod_perl after Perl sections
 MB processing?
 
 If you need Perl sections only to do initial web server
 configuration and you do not need mod_perl features in runtime then
 instead of using Perl just write Perl script to generate Apache
 config file from templates and run it before starting Apache. This way
 you do not need mod_perl on frontend Apache at all.


Yes, sure, that was my backup idea :) But I just wanted to make all 3
configs in one big file, because of tons of the parameters (like log
names, leves, auth, ssl etc). To keep it all together and start with -D
proxy or -D pages.

Thanks, but this would stay for the last chance :)
-- 
==
Mike Blazer
[EMAIL PROTECTED]
==



Re: Perl sections

2002-07-08 Thread Perrin Harkins

Mike Blazer wrote:
MB Or may be there is some way to un-load mod_perl after Perl sections
MB processing?

If you need Perl sections only to do initial web server
configuration and you do not need mod_perl features in runtime then
instead of using Perl just write Perl script to generate Apache
config file from templates and run it before starting Apache. This way
you do not need mod_perl on frontend Apache at all.
 
 Yes, sure, that was my backup idea :) But I just wanted to make all 3
 configs in one big file, because of tons of the parameters (like log
 names, leves, auth, ssl etc). To keep it all together and start with -D
 proxy or -D pages.

Well of course you can do exactly that with what Ilya suggested: one 
template file that your script uses to generate appropriate conf files 
for each server.  It's really your only choice for a proxy server.  It's 
also somewhat safer, since it means your database doesn't have to be up 
just to start your proxy server.

- Perrin




Re: Perl sections

2002-07-08 Thread Mike Blazer



Perrin Harkins wrote:
 
 Mike Blazer wrote:
 MB Or may be there is some way to un-load mod_perl after Perl sections
 MB processing?
 
 If you need Perl sections only to do initial web server
 configuration and you do not need mod_perl features in runtime then
 instead of using Perl just write Perl script to generate Apache
 config file from templates and run it before starting Apache. This way
 you do not need mod_perl on frontend Apache at all.
 
  Yes, sure, that was my backup idea :) But I just wanted to make all 3
  configs in one big file, because of tons of the parameters (like log
  names, leves, auth, ssl etc). To keep it all together and start with -D
  proxy or -D pages.
 
 Well of course you can do exactly that with what Ilya suggested: one
 template file that your script uses to generate appropriate conf files
 for each server.  It's really your only choice for a proxy server.  It's
 also somewhat safer, since it means your database doesn't have to be up
 just to start your proxy server.

Yeah, thanks. But the whole that site has nothing to do without the
database :) It almost has no static content.
But seems like you are both right. Template would be really safer. While
this also breaks the nice concept of starting each server with apachectl
-D name and having all confugurables (perl vars, hashes) together in
the same file.
-- 
==
Mike Blazer
[EMAIL PROTECTED]
==



Re: Perl sections

2002-07-08 Thread Randal L. Schwartz

 Mike == Mike Blazer [EMAIL PROTECTED] writes:

Mike Yeah, thanks. But the whole that site has nothing to do without the
Mike database :) It almost has no static content.
Mike But seems like you are both right. Template would be really safer. While
Mike this also breaks the nice concept of starting each server with apachectl
Mike -D name and having all confugurables (perl vars, hashes) together in
Mike the same file.

Solution:

generate

httpd.conf.pages
httpd.conf.proxy

using Template Toolkit.  Easy'nuff.  Lots of common stuff, plus unique
stuff.  You can use tpage and then there's not even any programming:

httpd.conf.pages: httpd.conf.tmpl
tpage --define server=pages  $  $@
httpd.conf.proxy: httpd.conf.tmpl
tpage --define server=proxy  $  $@

then check [% IF server = 'pages'; ... ; END %] in your templates.

Make httpd.conf be simply:

ifdefine pages
Include httpd.conf.pages
/ifdefine
ifdefine proxy
Include httpd.conf.proxy
/ifdefine
ifdefine !pages
ifdefine !proxy
Include httpd.conf.other
/ifdefine
/ifdefine

Done. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Perl sections

2002-07-08 Thread Randal L. Schwartz

 Randal == Randal L Schwartz [EMAIL PROTECTED] writes:

Randal using Template Toolkit.  Easy'nuff.  Lots of common stuff, plus unique
Randal stuff.  You can use tpage and then there's not even any programming:

Randal httpd.conf.pages: httpd.conf.tmpl
Randal tpage --define server=pages  $  $@
Randal httpd.conf.proxy: httpd.conf.tmpl
Randal tpage --define server=proxy  $  $@

Randal then check [% IF server = 'pages'; ... ; END %] in your templates.

Or duh, even simpler:

[%
  FOREACH server = ['pages', 'proxy'];
FILTER redirect(httpd.conf.$server);
-%]
... everything else ...
[%
END; # filter redirect
  END; # foreach
-%]

Then just tpage the file, and you've got a new version!

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Perl sections

2002-07-08 Thread Mike Blazer



Randal L. Schwartz wrote:
 
  Mike == Mike Blazer [EMAIL PROTECTED] writes:
 
 Mike Yeah, thanks. But the whole that site has nothing to do without the
 Mike database :) It almost has no static content.
 Mike But seems like you are both right. Template would be really safer. While
 Mike this also breaks the nice concept of starting each server with apachectl
 Mike -D name and having all confugurables (perl vars, hashes) together in
 Mike the same file.
 
 Solution:
 
 generate
 
 httpd.conf.pages
 httpd.conf.proxy
 
 using Template Toolkit.  Easy'nuff.  Lots of common stuff, plus unique
 stuff.  You can use tpage and then there's not even any programming:
 
 httpd.conf.pages: httpd.conf.tmpl
 tpage --define server=pages  $  $@
 httpd.conf.proxy: httpd.conf.tmpl
 tpage --define server=proxy  $  $@
 
 then check [% IF server = 'pages'; ... ; END %] in your templates.
 
 Make httpd.conf be simply:
 
 ifdefine pages
 Include httpd.conf.pages
 /ifdefine
 ifdefine proxy
 Include httpd.conf.proxy
 /ifdefine
 ifdefine !pages
 ifdefine !proxy
 Include httpd.conf.other
 /ifdefine
 /ifdefine
 
 Done. :)

Well, thanks, this is much what I'm doing

IfDefine be-image
   PidFile logs/httpd_image.pid
   ScoreBoardFile logs/apache_runtime_status.image

   Perl
$Counter::INI::httpd_name = image;
   /Perl
/IfDefine
IfDefine be-pages
   PidFile logs/httpd_pages.pid
   ScoreBoardFile logs/apache_runtime_status.pages

   Perl
$Counter::INI::httpd_name = pages;
   /Perl
/IfDefine
Perl
   $Counter::INI::ssl = 0;
/Perl
IfDefine SSL
   Perl
   $Counter::INI::ssl = 1;
   /Perl
/IfDefine

etc.

but then the virtual hosts vary so much that it's no use to use a
template - they are very different. Plus, my conf work also on my home
Win32 machine, so all paths are also calculated in Perl section. Plus
2 httpd+mod_perl servers (light and heavy) use different subsets of
modules (loaded in different startup.pl files). So, it'd anyway take to
generate a large parts of conf-code and send to template. I'm just
sending it directly to Apache-httpd_conf :)

But as for the proxy (without mod_perl) - yes, I'm already typing a
template, unfortunatelly it seems like the only way...

Anyway, for some future, may be it worth to use some efforts to be able
to use Perl sections even for the servers that don't need mod_perl
processing - by loading and unloading mod_perl or by loading it into
some separate thread and killing it after the server startup. It'd be
great to have this feature to configure Apache.

Thanks, I'll look into the templating thing. I'm a little stuck in my
mind in Perl sections, because it was already done this way in my
previous 1-server conf. Probably it's better to generate static
conf-files with small Perl parts with PerlSetVar's only.

I'll look into that, thanks.
-- 
==
Mike Blazer
[EMAIL PROTECTED]
==



Re: Problem with Perl sections in httpd.conf, mod_perl 1.26

2002-04-19 Thread PinkFreud

Here's a bit more information:

Given two directives:
$VirtualHost{$host}-{Alias} = [ '/perl/', $vhostdir/$dir/perl/ ];
$VirtualHost{$host}-{Alias} = $vhost{config}-{Alias};

The first works.  The second does not.  According to
Apache::PerlSections-dump, %VirtualHost is *exactly* the same when
using both directives - yet it seems the server ignores the Alias
directive when it's assigned from $vhost{config} (either that, mod_perl
fails to pass it to the server).
Also, if I set a variable within httpd.conf to mimic $vhost{config} and
then assign that to $VirtualHost{$host}, it works without a problem.
The issuse is definitely with the variable being read in from an
external file.

Strange, no?


On Fri, Apr 19, 2002 at 01:31:45AM -0400, PinkFreud babbled thus:
 Date: 19 Apr 2002 01:31:45 -0400
 Date: Fri, 19 Apr 2002 01:31:45 -0400
 From: PinkFreud [EMAIL PROTECTED]
 To: Salvador Ortiz Garcia [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: Problem with Perl sections in httpd.conf, mod_perl 1.26
 Mail-Followup-To: Salvador Ortiz Garcia [EMAIL PROTECTED],
   [EMAIL PROTECTED]
 User-Agent: Mutt/1.3.25i
 
 On Thu, Apr 18, 2002 at 11:15:15PM -0500, Salvador Ortiz Garcia babbled thus:
  Subject: Re: Problem with Perl sections in httpd.conf, mod_perl 1.26
  From: Salvador Ortiz Garcia [EMAIL PROTECTED]
  To: PinkFreud [EMAIL PROTECTED]
  Cc: [EMAIL PROTECTED]
  X-Mailer: Ximian Evolution 1.0.3 
  Date: 18 Apr 2002 23:15:15 -0500
  
  On Mon, 2002-04-15 at 23:17, PinkFreud wrote:
   I have a rather odd problem, one which I can only assume is a bug
   somewhere, due to how bizarre it is.
   
   I am attmempting to generate virtual host configs via mod_perl, using
   Perl sections in httpd.conf.  Not all hosts will be using a /perl
   Alias, though, so I'm reading in an external config, which looks like
   the following:
   
  [ Deleted ]
  
  Plese try changing your Alias array ref to a simple scalar:
  
 ...
   'Alias' = '/perl/ /home/vhosts/linuxhelp.mirkwood.net/perl/',
 ...
  
  That should work.
 
 Nope.  Still can't find it.
 
 What gets me is the syntax I use for Alias works just fine when the
 code is in httpd.conf.  It only fails to work when I read it in via a
 require'd file.  This same behavior occurs when I use your syntax in
 the require'd file as well.
 
 /me scratches his head, perplexed.
 
  
  And yes, I think its an old bug in perl_handle_command_av.
  
  Salvador Ortiz.
  

-- 

Mike Edwards

Brainbench certified Master Linux Administrator
http://www.brainbench.com/transcript.jsp?pid=158188
---
Unsolicited advertisments to this address are not welcome.



Re: Problem with Perl sections in httpd.conf, mod_perl 1.26

2002-04-19 Thread Salvador Ortiz Garcia

On Fri, 2002-04-19 at 01:43, PinkFreud wrote:
 Here's a bit more information:
 
 Given two directives:
 $VirtualHost{$host}-{Alias} = [ '/perl/', $vhostdir/$dir/perl/ ];
 $VirtualHost{$host}-{Alias} = $vhost{config}-{Alias};
 
 The first works.  The second does not.  According to
 Apache::PerlSections-dump, %VirtualHost is *exactly* the same when
 using both directives - yet it seems the server ignores the Alias
 directive when it's assigned from $vhost{config} (either that, mod_perl
 fails to pass it to the server).
 Also, if I set a variable within httpd.conf to mimic $vhost{config} and
 then assign that to $VirtualHost{$host}, it works without a problem.
 The issuse is definitely with the variable being read in from an
 external file.
 
 Strange, no?

Yes, weird.

I'm hunting any remaining bugs related to Perl Sections.

Can you please test the attached patch vs 1.26? (please forget about the
patch posted by Michel, it is mine and in CVS now, but in this I'm
trying a more radical approach and checking for the proper nesting of
directives)

Then try to reproduce your problems under MOD_PERL_TRACE=ds (see the
DEBUGGIN section in the mod_perl man page), thats is, compile mod_perl
with PERL_TRACE=1 and run your Apache in single process mode:

  # MOD_PERL_TRACE=ds path_to_your/httpd -X

And please post the generated log.

Regards.

Salvador Ortiz


diff -ru mod_perl-1.26.orig/src/modules/perl/perl_config.c mod_perl-1.26.msg/src/modules/perl/perl_config.c
--- mod_perl-1.26.orig/src/modules/perl/perl_config.c	Tue Jul 10 20:47:15 2001
+++ mod_perl-1.26.msg/src/modules/perl/perl_config.c	Thu Feb 21 01:43:10 2002
 -51,6 +51,7 
 #include mod_perl.h
 
 extern API_VAR_EXPORT module *top_module;
+IV mp_cmdparms = 0;
 
 #ifdef PERL_SECTIONS
 static int perl_sections_self_boot = 0;
 -1166,6 +1167,9 
 char *tmpkey; 
 I32 tmpklen; 
 SV *tmpval;
+const command_rec *orec = cmd-cmd;
+const char *old_end_token = cmd-end_token;
+cmd-end_token = (const char *)cmd-info;
 (void)hv_iterinit(hv); 
 while ((tmpval = hv_iternextsv(hv, tmpkey, tmpklen))) { 
 	char line[MAX_STRING_LEN]; 
 -1173,6 +1177,13 
 	if (SvMAGICAL(tmpval)) mg_get(tmpval); /* tied hash FETCH */
 	if(SvROK(tmpval)) {
 	if(SvTYPE(SvRV(tmpval)) == SVt_PVAV) {
+		module *tmod = top_module;
+		const command_rec *c; 
+		if(!(c = find_command_in_modules((const char *)tmpkey, tmod))) {
+		fprintf(stderr, command_rec for directive `%s' not found!\n, tmpkey);
+		continue;
+		}
+		cmd-cmd = c; /* for do_quote */
 		perl_handle_command_av((AV*)SvRV(tmpval), 
    0, tmpkey, cmd, cfg);
 		continue;
 -1195,8 +1206,12 
 	if(errmsg)
 	log_printf(cmd-server, Perl: %s, errmsg);
 }
-/* Emulate the handling of end token for the section */ 
+cmd-cmd = orec;
+cmd-info = cmd-end_token;
+cmd-end_token = old_end_token;
+/* Emulate the handling of end token for the section  
 perl_set_config_vectors(cmd, cfg, core_module);
+*/
 } 
 
 #ifdef WIN32
 -1225,13 +1240,21 
 pool *p = cmd-pool;
 char *arg; 
 const char *errmsg = NULL;
+const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
+if (err != NULL) {
+return err;
+}
+if (main_server-is_virtual) {
+	return VirtualHost doesn't nest!;
+}
+
 dSECiter_start
 
 if(entries) {
 	SECiter_list(perl_virtualhost_section(cmd, dummy, tab));
 }
 
-arg = pstrdup(cmd-pool, getword_conf (cmd-pool, key));
+arg = getword_conf (cmd-pool, key);
 
 #if MODULE_MAGIC_NUMBER = 19970912
 errmsg = init_virtual_host(p, arg, main_server, s);
 -1256,9 +1279,9 
 perl_section_hash_walk(cmd, s-lookup_defaults, tab);
 
 cmd-server = main_server;
+TRACE_SECTION_END(VirtualHost);
 
 dSECiter_stop
-TRACE_SECTION_END(VirtualHost);
 return NULL;
 }
 
 -1281,6 +1304,11 
 #ifdef PERL_TRACE
 char *sname = SECTION_NAME(Location);
 #endif
+const char *err = ap_check_cmd_context(cmd,
+	   NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
+if (err != NULL) {
+return err;
+}
 
 dSECiter_start
 
 -1295,10 +1323,10 
 
 new_url_conf = create_per_dir_config (cmd-pool);
 
-cmd-path = pstrdup(cmd-pool, getword_conf (cmd-pool, key));
+cmd-path = getword_conf (cmd-pool, key);
 cmd-override = OR_ALL|ACCESS_CONF;
 
-if (cmd-info) { /* LocationMatch */
+if (cmd-cmd-cmd_data) { /* LocationMatch */
 	r = pregcomp(cmd-pool, cmd-path, REG_EXTENDED);
 }
 else if (!strcmp(cmd-path, ~)) {
 -1317,12 +1345,12 
 conf-r = r;
 
 add_per_url_conf (cmd-server, new_url_conf);
+TRACE_SECTION_END(sname);
 	
 dSECiter_stop
 
 cmd-path = old_path;
 cmd-override = old_overrides;
-TRACE_SECTION_END(sname);
 return NULL;
 }
 
 -1334,6 +1362,11 
 #ifdef PERL_TRACE
 char *sname = SECTION_NAME(Directory);
 #endif
+const char *err = ap_check_cmd_context(cmd,
+	   NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
+if (err != NULL

Re: Problem with Perl sections in httpd.conf, mod_perl 1.26

2002-04-19 Thread PinkFreud

Log is attached.  I'm amused with this line:

handle_command (Alias /perl/ /home/vhosts/linuxhelp.mirkwood.net/perl/): OK

That looks right, but I *still* get a 404 error:

 404 Not Found 

   Not Found

   The requested URL /perl/ was not found on this server.   
 _  


Apache/1.3.24 Server at linuxhelp.mirkwood.net Port 80   

[Fri Apr 19 21:33:08 2002] [error] [client x.x.x.x] File does not exist: 
/home/vhosts/linuxhelp.mirkwood.net/htdocs/perl/
(note it's still trying to go to htdocs/perl/)

ls -d /home/vhosts/linuxhelp.mirkwood.net/perl/
drwxr-xr-x2 root root 4096 Apr 15 02:07
/home/vhosts/linuxhelp.mirkwood.net/perl//


Hope that helps.


On Fri, Apr 19, 2002 at 03:37:35PM -0500, Salvador Ortiz Garcia babbled thus:
 Subject: Re: Problem with Perl sections in httpd.conf, mod_perl 1.26
 From: Salvador Ortiz Garcia [EMAIL PROTECTED]
 To: PinkFreud [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 X-Mailer: Ximian Evolution 1.0.3 
 Date: 19 Apr 2002 15:37:35 -0500
 
 On Fri, 2002-04-19 at 01:43, PinkFreud wrote:
  Here's a bit more information:
  
  Given two directives:
  $VirtualHost{$host}-{Alias} = [ '/perl/', $vhostdir/$dir/perl/ ];
  $VirtualHost{$host}-{Alias} = $vhost{config}-{Alias};
  
  The first works.  The second does not.  According to
  Apache::PerlSections-dump, %VirtualHost is *exactly* the same when
  using both directives - yet it seems the server ignores the Alias
  directive when it's assigned from $vhost{config} (either that, mod_perl
  fails to pass it to the server).
  Also, if I set a variable within httpd.conf to mimic $vhost{config} and
  then assign that to $VirtualHost{$host}, it works without a problem.
  The issuse is definitely with the variable being read in from an
  external file.
  
  Strange, no?
 
 Yes, weird.
 
 I'm hunting any remaining bugs related to Perl Sections.
 
 Can you please test the attached patch vs 1.26? (please forget about the
 patch posted by Michel, it is mine and in CVS now, but in this I'm
 trying a more radical approach and checking for the proper nesting of
 directives)
 
 Then try to reproduce your problems under MOD_PERL_TRACE=ds (see the
 DEBUGGIN section in the mod_perl man page), thats is, compile mod_perl
 with PERL_TRACE=1 and run your Apache in single process mode:
 
   # MOD_PERL_TRACE=ds path_to_your/httpd -X
 
 And please post the generated log.
 
 Regards.
 
 Salvador Ortiz



-- 

Mike Edwards

Brainbench certified Master Linux Administrator
http://www.brainbench.com/transcript.jsp?pid=158188
---
Unsolicited advertisments to this address are not welcome.


loading perl module 'Apache'...loading perl module 'Apache::Constants::Exports'...ok
ok
init `PerlHandler' stack
perl_cmd_push_handlers: @PerlHandler, 'Apache::Status'
pushing `Apache::Status' into `PerlHandler' handlers
[Fri Apr 19 21:32:57 2002] [warn] module mod_php4.c is already added, skipping
[Fri Apr 19 21:32:57 2002] [warn] module mod_ssl.c is already added, skipping
loading perl module 'Apache'...ok
loading perl module 'Tie::IxHash'...not ok
Warn: Directive `vhost' not found in handle_command_av!
LocationMatch OK
perl_section: VirtualHost linuxhelp.mirkwood.net
perl_section: Location /perl/
init `PerlHandler' stack
perl_cmd_push_handlers: @PerlHandler, 'Apache::Registry'
pushing `Apache::Registry' into `PerlHandler' handlers
PerlHandler Apache::Registry (OK) Limit=no
Options ExecCGI (OK) Limit=no
SetHandler perl-script (OK) Limit=no
perl_section: /Location
Location OK
DocumentRoot /home/vhosts/linuxhelp.mirkwood.net/htdocs (OK) Limit=no
Group users (OK) Limit=no
ServerAdmin test@vhost (OK) Limit=no
handle_command (Alias /perl/ /home/vhosts/linuxhelp.mirkwood.net/perl/): OK
CustomLog /home/vhosts/linuxhelp.mirkwood.net/logs/linuxhelp.mirkwood.net.access_log 
combined (OK) Limit=no
User sauron (OK) Limit=no
ServerName linuxhelp.mirkwood.net (OK) Limit=no
ErrorLog /home/vhosts/linuxhelp.mirkwood.net/logs/linuxhelp.mirkwood.net.error_log 
(OK) Limit=no
handle_command (ScriptAlias /cgi-bin/ 
/home/vhosts/linuxhelp.mirkwood.net/cgi-bin/): OK
ServerAlias linuxhelp (OK) Limit=no
perl_section: /VirtualHost
perl_section: VirtualHost orodruin.rivendell.mirkwood.net
CustomLog /var/log/apache/orodruin.access_log combined (OK) Limit=no
ServerAlias orodruin (OK) Limit=no
ProxyPassReverse / http://orodruin.mirkwood.net:80/ (OK) Limit=no
ServerName

Re: Problem with Perl sections in httpd.conf, mod_perl 1.26

2002-04-18 Thread PinkFreud

On Thu, Apr 18, 2002 at 11:15:15PM -0500, Salvador Ortiz Garcia babbled thus:
 Subject: Re: Problem with Perl sections in httpd.conf, mod_perl 1.26
 From: Salvador Ortiz Garcia [EMAIL PROTECTED]
 To: PinkFreud [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 X-Mailer: Ximian Evolution 1.0.3 
 Date: 18 Apr 2002 23:15:15 -0500
 
 On Mon, 2002-04-15 at 23:17, PinkFreud wrote:
  I have a rather odd problem, one which I can only assume is a bug
  somewhere, due to how bizarre it is.
  
  I am attmempting to generate virtual host configs via mod_perl, using
  Perl sections in httpd.conf.  Not all hosts will be using a /perl
  Alias, though, so I'm reading in an external config, which looks like
  the following:
  
 [ Deleted ]
 
 Plese try changing your Alias array ref to a simple scalar:
 
...
  'Alias' = '/perl/ /home/vhosts/linuxhelp.mirkwood.net/perl/',
...
 
 That should work.

Nope.  Still can't find it.

What gets me is the syntax I use for Alias works just fine when the
code is in httpd.conf.  It only fails to work when I read it in via a
require'd file.  This same behavior occurs when I use your syntax in
the require'd file as well.

/me scratches his head, perplexed.

 
 And yes, I think its an old bug in perl_handle_command_av.
 
 Salvador Ortiz.
 

-- 

Mike Edwards

Brainbench certified Master Linux Administrator
http://www.brainbench.com/transcript.jsp?pid=158188
---
Unsolicited advertisments to this address are not welcome.



Re: Problem with Perl sections in httpd.conf, mod_perl 1.26

2002-04-16 Thread Michael Schout

On 16 Apr 2002, PinkFreud wrote:

 I have a rather odd problem, one which I can only assume is a bug
 somewhere, due to how bizarre it is.

 I am attmempting to generate virtual host configs via mod_perl, using
 Perl sections in httpd.conf.  Not all hosts will be using a /perl
 Alias, though, so I'm reading in an external config, which looks like
 the following:

This sounds like hte problem that I suffered with for about a year, until
someone posted this patch recently to the mod_perl list that fixes the problem
for me.  For me, the symptom was that *sometimes*, certain entries in Perl
sections would not configure, no matter what was placed in them.  The patch
below fixes it for me.  Try the patch below and see if the problem goes away.
I'm not sure if this patch has made it into CVS yet or not.

Regards,
Mike

--
diff -ur mod_perl-1.26.orig/src/modules/perl/perl_config.c 
mod_perl-1.26/src/modules/perl/perl_config.c
--- mod_perl-1.26.orig/src/modules/perl/perl_config.c   Tue Jul 10 21:47:15 2001
+++ mod_perl-1.26/src/modules/perl/perl_config.cWed Feb 20 14:59:00 2002
 -1166,6 +1166,7 
 char *tmpkey;
 I32 tmpklen;
 SV *tmpval;
+void *old_info = cmd-info;
 (void)hv_iterinit(hv);
 while ((tmpval = hv_iternextsv(hv, tmpkey, tmpklen))) {
char line[MAX_STRING_LEN];
 -1195,6 +1196,7 
if(errmsg)
log_printf(cmd-server, Perl: %s, errmsg);
 }
+cmd-info = old_info;
 /* Emulate the handling of end token for the section */
 perl_set_config_vectors(cmd, cfg, core_module);
 }
 -1511,9 +1513,7 
 void *dummy = perl_set_config_vectors(cmd, config, core_module);
 void *old_info = cmd-info;

-if (strstr(key, Match)) {
-   cmd-info = (void*)key;
-}
+cmd-info = (void*)strstr(key,Match);

 if(strnEQ(key, Location, 8))
perl_urlsection(cmd, dummy, hv);
--





Re: Problem with Perl sections in httpd.conf, mod_perl 1.26

2002-04-16 Thread PinkFreud

Thanks for the patch, Michael.  Unfortunately, this doesn't seem to fix
my problem.  :(

[Tue Apr 16 19:11:47 2002] [error] [client x.x.x.x] File does not exist: 
/home/vhosts/linuxhelp.mirkwood.net/htdocs/perl/

It's still ignoring the Alias directive, when require'd from another
file.

On Tue, Apr 16, 2002 at 02:53:35PM -0500, Michael Schout babbled thus:
 Date: Tue, 16 Apr 2002 14:53:35 -0500 (CDT)
 From: Michael Schout [EMAIL PROTECTED]
 To: PinkFreud [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: Problem with Perl sections in httpd.conf, mod_perl 1.26
 
 On 16 Apr 2002, PinkFreud wrote:
 
  I have a rather odd problem, one which I can only assume is a bug
  somewhere, due to how bizarre it is.
 
  I am attmempting to generate virtual host configs via mod_perl, using
  Perl sections in httpd.conf.  Not all hosts will be using a /perl
  Alias, though, so I'm reading in an external config, which looks like
  the following:
 
 This sounds like hte problem that I suffered with for about a year, until
 someone posted this patch recently to the mod_perl list that fixes the problem
 for me.  For me, the symptom was that *sometimes*, certain entries in Perl
 sections would not configure, no matter what was placed in them.  The patch
 below fixes it for me.  Try the patch below and see if the problem goes away.
 I'm not sure if this patch has made it into CVS yet or not.
 
 Regards,
 Mike
 
 --
 diff -ur mod_perl-1.26.orig/src/modules/perl/perl_config.c 
mod_perl-1.26/src/modules/perl/perl_config.c
 --- mod_perl-1.26.orig/src/modules/perl/perl_config.c   Tue Jul 10 21:47:15 2001
 +++ mod_perl-1.26/src/modules/perl/perl_config.cWed Feb 20 14:59:00 2002
 @@ -1166,6 +1166,7 @@
  char *tmpkey;
  I32 tmpklen;
  SV *tmpval;
 +void *old_info = cmd-info;
  (void)hv_iterinit(hv);
  while ((tmpval = hv_iternextsv(hv, tmpkey, tmpklen))) {
 char line[MAX_STRING_LEN];
 @@ -1195,6 +1196,7 @@
 if(errmsg)
 log_printf(cmd-server, Perl: %s, errmsg);
  }
 +cmd-info = old_info;
  /* Emulate the handling of end token for the section */
  perl_set_config_vectors(cmd, cfg, core_module);
  }
 @@ -1511,9 +1513,7 @@
  void *dummy = perl_set_config_vectors(cmd, config, core_module);
  void *old_info = cmd-info;
 
 -if (strstr(key, Match)) {
 -   cmd-info = (void*)key;
 -}
 +cmd-info = (void*)strstr(key,Match);
 
  if(strnEQ(key, Location, 8))
 perl_urlsection(cmd, dummy, hv);
 --
 
 

-- 

Mike Edwards

Brainbench certified Master Linux Administrator
http://www.brainbench.com/transcript.jsp?pid=158188
---
Unsolicited advertisments to this address are not welcome.



Problem with Perl sections in httpd.conf, mod_perl 1.26

2002-04-15 Thread PinkFreud

I have a rather odd problem, one which I can only assume is a bug
somewhere, due to how bizarre it is.

I am attmempting to generate virtual host configs via mod_perl, using
Perl sections in httpd.conf.  Not all hosts will be using a /perl
Alias, though, so I'm reading in an external config, which looks like
the following:

### Begin external vhost config ###
$suexec = 0;

$vhost{config} = {
  Location = {
/perl/ = {
  SetHandler = perl-script,
  PerlHandler = Apache::Registry,
  Options = ExecCGI
}
  },
  Alias = [ '/perl/' = $vhostdir/$dir/perl/ ]
};
### End external vhost config #

This config is being read by the following line:
require $vhostdir/$dir/.config if (-r $vhostdir/$dir/.config);

The configuration options are being added to %VirtualHost as follows:
map { $VirtualHost{$host}-{$_} = $vhost{config}-{$_} } keys(%{$vhost{config}});

Now for the oddity:
The above doesn't work.  Both Data::Dumper and Apache::PerlSections
show the options as being added to %VirtualHost, but the server never
seems to see the Alias (no idea on the Location directive, since the
Alias fails to work).  Examination of the error_log shows that the
server is trying to get htdocs/perl/, as if the Alias didn't exist.

Just to make things a bit stranger: if I add those sections directly
into my vhost code in httpd.conf, they work.  Again, Data::Dumper and
Apache::PerlSections shows what I expect (other than the options being
ordered a bit differently in the hash, but that's normal).  This is
what makes me suspect a bug, because this is so bizarre.

Included below is the output I grabbed from Apache:PerlSections in both
cases.

Any ideas?  This problem is really quite annoying.


### Working config #
%VirtualHost = (
  'linuxhelp.mirkwood.net' = {
'Location' = {
  '/perl/' = {
'PerlHandler' = 'Apache::Registry',
'Options' = 'ExecCGI',
'SetHandler' = 'perl-script'
  }
},
'DocumentRoot' = '/home/vhosts/linuxhelp.mirkwood.net/htdocs',
'ServerAdmin' = 'test@vhost',
'CustomLog' = 
'/home/vhosts/linuxhelp.mirkwood.net/logs/linuxhelp.mirkwood.net.access_log combined',
'Alias' = [
  '/perl/',
  '/home/vhosts/linuxhelp.mirkwood.net/perl/'
],
'ServerName' = 'linuxhelp.mirkwood.net',
'ErrorLog' = 
'/home/vhosts/linuxhelp.mirkwood.net/logs/linuxhelp.mirkwood.net.error_log',
'ScriptAlias' = [
  '/cgi-bin/',
  '/home/vhosts/linuxhelp.mirkwood.net/cgi-bin/'
],
'ServerAlias' = 'linuxhelp'
  }
);


### Alias is broken here - WHY? 
%VirtualHost = (
  'linuxhelp.mirkwood.net' = {
'Location' = {
  '/perl/' = {
'PerlHandler' = 'Apache::Registry',
'Options' = 'ExecCGI',
'SetHandler' = 'perl-script'
  }
},
'ScriptAlias' = [
  '/cgi-bin/',
  '/home/vhosts/linuxhelp.mirkwood.net/cgi-bin/'
],
'DocumentRoot' = '/home/vhosts/linuxhelp.mirkwood.net/htdocs',
'ServerAdmin' = 'test@vhost',
'Alias' = [
  '/perl/',
  '/home/vhosts/linuxhelp.mirkwood.net/perl/'
],
'CustomLog' = 
'/home/vhosts/linuxhelp.mirkwood.net/logs/linuxhelp.mirkwood.net.access_log combined',
'ServerAlias' = 'linuxhelp',
'ServerName' = 'linuxhelp.mirkwood.net',
'ErrorLog' = 
'/home/vhosts/linuxhelp.mirkwood.net/logs/linuxhelp.mirkwood.net.error_log'
  }
);

-- 

Mike Edwards

Brainbench certified Master Linux Administrator
http://www.brainbench.com/transcript.jsp?pid=158188
---
Unsolicited advertisments to this address are not welcome.



RE: Perl Sections: command_rec for directive `ISA' not found!

2002-01-31 Thread Jonathan Hilgeman

I previously posted the below, but after experiencing this same problem
after upgrading MySQL, I did some research and noticed that I had to
re-compile/re-install the Msql-Mysql-modules-1.2216.tar.gz package/module
when the libmysqlclient.so file got updated. 

For instance, I first installed the perl module when I had MySQL 3.23.36,
which compiles libmysqlclient.so.6, and then I just upgraded to MySQL
3.23.47, which compiles/relies on libmysqlclient.so.10. I now had to
re-install the Msql-Mysql-modules package using the new libmysqlclient.so.10
file (I believe it was in the Makefile, but I could be wrong). After I did
that, everything worked fine.

- Jonathan

--- Original Message ---
Seeing that nobody answered your question or posted the answer, I had to
overcome this same problem. The problem was the Perl libraries that were
installed (or not installed). You need to reinstall / install the
Bundle::DBI package and the correct modules for it. In my case, I was trying
to dynamically build VirtualHost directives from a mySQL database. I
telnetted/ssh to the shell and typed the following:

su-2.04#  perl -MCPAN -e shell

cpan install Bundle::DBI

 Bundle gets installed 

cpan install Msql-Mysql-modules-1.2216.tar.gz

 Package starts installing 

When it asked me if I wanted mSQL, mySQL, or both, I chose mySQL only. 
It asked me where the subdirectory with the include files was, and it
defaulted to /usr/local. This caught me off-guard because mySQL was actually
installed in /usr/local/mysql and so I kept putting that directory, but it
kept failing. When I tried reinstalling, I left it at /usr/local and it went
through fine. 

Now that the packages are installed, I had one more error to fix. In the
Perl section, I had:

$dbh = DBI-connect('DBI:mysql: ..blah..blah...');

which had to be changed to 

my $dbh = DBI-connect('DBI:mysql: ..blah..blah...');

Otherwise, Apache will not recognize the variables and will return an error
about commands and stuff.

Hope this helps!

Jonathan Hilgeman



Pushing Handlers from Perl sections

2001-12-11 Thread Issac Goldstand

Can I _upsh_ handlers from within Perl sections?  If so, how?  

  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








Perl sections from within a module

2001-11-22 Thread Issac Goldstand



Is there a way of doing configuration work (the 
equivalent of Perl sections) from within modules? I ask both for 
subroutines which are called at server startup (from mod_perl_start.pl) and from 
other handlers...

Thanks in advance,
 Issac

Internet is a wonderful mechanism for making a fool 
ofyourself 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: Perl sections from within a module

2001-11-22 Thread Stas Bekman

Issac Goldstand wrote:

 Is there a way of doing configuration work (the equivalent of Perl 
 sections) from within modules?  I ask both for subroutines which are 
 called at server startup (from mod_perl_start.pl) and from other handlers...

Yup, just modify things in Apache::ReadConfig package. The only magical 
thing about Perl/Perl is that it declares:

package Apache::ReadConfig;

for you...

it's explained here:
http://perl.apache.org/guide/config.html#Apache_Configuration_in_Perl
(and I think the eagle book):
_
Stas Bekman JAm_pH  --   Just Another mod_perl Hacker
http://stason.org/  mod_perl Guide   http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/




perl sections

2001-11-02 Thread matt

Hello list,

I am running some mod_perl/apache sites. So far we have 2 disparate
servers, (both running identical software) hosting about 10 sites
each.

I have managed to create a universal httpd.conf using perl
sections, a universal config file and a host dependant config file.

In doing so I've come up across some things I've not been able to do
using perl sections:

1/- Having to use more than 1 perl section in the config.

This is annoying because I initialize a load of stuff and then its all
lost when the section ends. I have to end the section, because I set
the module path like this:

@PerlSetEnv = 
(
[ 'someflag', $somevar ],
[ 'modulepath', $someothervar ],
);

I can't then 'use' a module in the module path until that section has
been eval'ed - which means I have to end the section. I know I could
do it with a plain apache directive, but then my httpd.conf is not
truly universal.

2/- mod_rewrite

After using mod_rewrite on the default server, I then had to turn it
off everywhere else I had a virtual host or location. The mod_rewrite
docs say:

This means that you need to have a RewriteEngine on
directive for each virtual host in which you wish to use it.

But it just stays stuck on unless you explicitly turn it off.

3/- ErrorDocument directives don't seem to work

I eventually gave up on getting these to work in perl sections. Now I
do them before the start of the first perl. Anyone else have better
luck?

4/- Tie::IxHash

Apparently if you have this installed before you configure/install
mod_perl, it will automatically use it to preserve order in hashes. It
doesn't work in my case, and I have to explicitly tie the hashes where
this is important to get things working properly. 

Thanks for any light shed on the above,

Matt

-- 
#!/usr/bin/perl
$A='A';while(print+($A.=(grep{($A=~/(...).{78}$/)[0]eq$_}  A A A  
=~m{(...)}g)?A: )=~/([ A])$/){if(!(++$l%80)){print\n;sleep 1}}





Re: Problem with Directory in Perl sections

2001-11-01 Thread Richard L. Goerwitz III

James Stalker wrote:

 Does anyone here have Directory working in Perl sections in mod_perl
 1.25 or above?

It's funny that you mention this because, now that I think
about it, I always set up directory and location blocks inside
virtual host blocks, e.g.:

$VirtualHost{_default_:80} = {
  ServerName  = $hostname,
  DirectoryIndex  = 'index.html index.shtml index.epl',
  etc...
  Location = {
'/admin/perl-status' = {
  SetHandler  = 'perl-script',
  PerlHandler = 'Apache::Status'
},
etc...
  },
  FilesMatch = {
q(.*\\.epl$) = {
  SetHandler  = 'perl-script',
  PerlHandler = 'HTML::Embperl',
  Options = '+ExecCGI'
},
etc...
  },
  Directory = {
directory stuff goes here
  }
}

-- 

Richard Goerwitz   [EMAIL PROTECTED]
tel: 401 438 8978



Re: Problem with Directory in Perl sections

2001-10-31 Thread James Stalker

OK, looks like no-one has any ideas - maybe I should rephrase the question.

Does anyone here have Directory working in Perl sections in mod_perl 1.25 or above?

Thanks,

Jim


On Mon, Oct 29, 2001 at 08:58:24AM +, James Stalker wrote:
 Hi,
 
 I have hit a problem with the latest couple of versions of mod_perl, and I wondered 
if anyone might know a solution.
 
 We're using Apache 1.3.22 with mod_perl 1.26, and there appears to be a problem with 
the Directory directive in perl sections...
 e.g.
 
 $Directory{$DocumentRoot}={
 Options =  '-Indexes FollowSymLinks',
 AllowOverride   =  'None',
 SetHandler  =  'perl-script',
 PerlHandler =  'Apache::EnsEMBL::SendDecPage',
 order   =  'deny,allow',
 allow   =  'from all',
 };
 
 does not work in a Perl section but it works fine outside:
 
 Directory /mysql/ensembl/www/sanger-test/htdocs 
 Options -Indexes FollowSymLinks
 AllowOverride   None
 SetHandler  perl-script
 PerlHandler Apache::EnsEMBL::SendDecPage
 order   deny,allow
 allow   from all
 /Directory
 
 /perl-status reports that the former looks as I would expect:
 
 %Directory = (
   '/mysql/ensembl/www/server/htdocs' = {
 'Deny' = 'from all',
 'AllowOverride' = 'None',
 'Order' = 'deny,allow',
 'PerlHandler' = 'Apache::EnsEMBL::SendDecPage',
 'Options' = '-Indexes FollowSymLinks',
 'SetHandler' = 'perl-script'
   },
 );
 
 There are no errors reported, but the handler simply doesn't kick in.  We have been 
using this config for some months now, and this worked fine in 1.21.  It stopped 
working by at least version 1.25.
 
 Anybody have any ideas?
 
 Regards,
 
 James

-- 
James Stalker
Senior Web Developer - Project Ensembl - http://www.ensembl.org



Problem with Directory in Perl sections

2001-10-29 Thread James Stalker

Hi,

I have hit a problem with the latest couple of versions of mod_perl, and I wondered if 
anyone might know a solution.

We're using Apache 1.3.22 with mod_perl 1.26, and there appears to be a problem with 
the Directory directive in perl sections...
e.g.

$Directory{$DocumentRoot}={
Options =  '-Indexes FollowSymLinks',
AllowOverride   =  'None',
SetHandler  =  'perl-script',
PerlHandler =  'Apache::EnsEMBL::SendDecPage',
order   =  'deny,allow',
allow   =  'from all',
};

does not work in a Perl section but it works fine outside:

Directory /mysql/ensembl/www/sanger-test/htdocs 
Options -Indexes FollowSymLinks
AllowOverride   None
SetHandler  perl-script
PerlHandler Apache::EnsEMBL::SendDecPage
order   deny,allow
allow   from all
/Directory

/perl-status reports that the former looks as I would expect:

%Directory = (
  '/mysql/ensembl/www/server/htdocs' = {
'Deny' = 'from all',
'AllowOverride' = 'None',
'Order' = 'deny,allow',
'PerlHandler' = 'Apache::EnsEMBL::SendDecPage',
'Options' = '-Indexes FollowSymLinks',
'SetHandler' = 'perl-script'
  },
);

There are no errors reported, but the handler simply doesn't kick in.  We have been 
using this config for some months now, and this worked fine in 1.21.  It stopped 
working by at least version 1.25.

Anybody have any ideas?

Regards,

James

-- 
James Stalker
Senior Web Developer - Project Ensembl - http://www.ensembl.org




Re: Odd problem with Perl sections

2001-10-25 Thread Carolyn

On Wed, Oct 24, 2001 at 03:01:25AM -0700, Tom Mornini wrote:
 in httpd.conf:
 
 1  Perl
 2$ErrorLog = |/home/tmornini/Source/ewingz/bin/spread_from_stdin.pl 
 ERROR;
 3  /Perl
 
 4  ErrorLog |/home/tmornini/Source/ewingz/bin/spread_from_stdin.pl 
 ERROR
 
 Lines 1-3 and 4 should do the same thing. They don't. 

I was having this exact problem yesterday, with CustomLog and LogFormat. I
think it's to do with quotes - try putting single quotes around your
$ErrorLog value, so apache will still see it as a quoted string.

- carolyn




Re: Odd problem with Perl sections

2001-10-25 Thread Tom Mornini

On Wednesday, October 24, 2001, at 06:38 PM, Carolyn wrote:

 On Wed, Oct 24, 2001 at 03:01:25AM -0700, Tom Mornini wrote:
 in httpd.conf:

 1  Perl
 2$ErrorLog = 
 |/home/tmornini/Source/ewingz/bin/spread_from_stdin.pl
 ERROR;
 3  /Perl

 4  ErrorLog |/home/tmornini/Source/ewingz/bin/spread_from_stdin.pl
 ERROR

 Lines 1-3 and 4 should do the same thing. They don't.

 I was having this exact problem yesterday, with CustomLog and 
 LogFormat. I
 think it's to do with quotes - try putting single quotes around your
 $ErrorLog value, so apache will still see it as a quoted string.

I too am setting CustomLog, and it takes two or three values. So I set
@CustomLog and everything is fine. I set LogFormat outside the Perl
section and have no need to make it dynamic, so I can't comment here.

I worked around this by removing the need for the extra argument for
the program I wanted to pipe to, the 'ERROR' in the above example.
I just wrapped spread_from_stdin.pl with a shell script, and everything
is fine, but I really do suspect that this is a bug.

I don't believe that single quotes -vs- double quotes would make a
difference. Both things end up a single scalar, and I seriously doubt
that Apache can tell the difference...

--
-- Tom Mornini
-- InfoMania Printing  Prepress




Re: Odd problem with Perl sections

2001-10-25 Thread Carolyn Hicks

On Wed, Oct 24, 2001 at 06:52:13PM -0700, Tom Mornini wrote:
 I don't believe that single quotes -vs- double quotes would make a
 difference. Both things end up a single scalar, and I seriously doubt
 that Apache can tell the difference...

well, I meant single *and* double quotes - so the value of $Errorlog
is actually quoted itself, like it is in the non-perl-ified directive,
because it contains a space.  This fixed the problem I was having with
LogFormat.  But if it's working for you now, cool.

-carolyn




Re: Odd problem with Perl sections

2001-10-25 Thread Tom Mornini

On Wednesday, October 24, 2001, at 07:25 PM, Carolyn Hicks wrote:

 On Wed, Oct 24, 2001 at 06:52:13PM -0700, Tom Mornini wrote:
 I don't believe that single quotes -vs- double quotes would make a
 difference. Both things end up a single scalar, and I seriously doubt
 that Apache can tell the difference...

 well, I meant single *and* double quotes - so the value of $Errorlog
 is actually quoted itself, like it is in the non-perl-ified directive,
 because it contains a space.  This fixed the problem I was having with
 LogFormat.  But if it's working for you now, cool.

Oh! I see now... :-)

Thanks, that's very interesting. I completely misunderstood your first
response, sorry about that!

--
-- Tom Mornini
-- InfoMania Printing  Prepress




Re: Odd problem with Perl sections

2001-10-25 Thread Tom Mornini

On Wednesday, October 24, 2001, at 11:38 AM, Scott Lanning wrote:

 On Wed, 24 Oct 2001, Tom Mornini wrote:
 1  Perl
 2$ErrorLog = 
 |/home/tmornini/Source/ewingz/bin/spread_from_stdin.pl ERROR;
 3  /Perl

 4  ErrorLog |/home/tmornini/Source/ewingz/bin/spread_from_stdin.pl 
 ERROR
 [snip]
 When I use the Perl section (which I need to allow the path to
 spread_from_stdin.pl to be dynamic at runtime) I receive this error:

 [Wed Oct 24 09:52:25 2001] [error] Perl: ErrorLog takes one argument,
 The filename of the error log

 On line 4, you passed one argument delimited by quotation marks.
 On line 2, you passed two arguments:
1) |/home/tmornini/Source/ewingz/bin/spread_from_stdin.pl
2) ERROR
 so it seems you need to escape the space between them somehow
 (I guess by a backslash, or put single quotes around the double
 quotes, but I didn't test it).

Yes, you're the second person to mention it, but you said it more 
clearly...

This will work...

$ErrorLog = q[|/home/tmornini/Source/ewingz/bin/spread_from_stdin.pl 
ERROR];

or qq[] if you need interpolation. (which I do)

--
-- Tom Mornini
-- InfoMania Printing  Prepress




Odd problem with Perl sections

2001-10-24 Thread Tom Mornini

I'm having a problem with Perl sections that I'm pretty sure shows a 
bug
of some sort in the code that handles this. I've looked around a bit and
can't find any Perl that is responsible for generating the error show 
below,
so I figured asking the list was the best next step.

in httpd.conf:

1  Perl
2$ErrorLog = |/home/tmornini/Source/ewingz/bin/spread_from_stdin.pl 
ERROR;
3  /Perl

4  ErrorLog |/home/tmornini/Source/ewingz/bin/spread_from_stdin.pl 
ERROR

Lines 1-3 and 4 should do the same thing. They don't. I was banging my 
head
against the wall with lines 1-3, so I took them out and added line 4, 
which
works properly. I don't use them simultaneously, but mutually 
exclusively.

When I use the Perl section (which I need to allow the path to
spread_from_stdin.pl to be dynamic at runtime) I receive this error:

[Wed Oct 24 09:52:25 2001] [error] Perl: ErrorLog takes one argument, 
The filename of the error log

I think that this is a bug in whatever code validates $ErrorLog. It seems
it doesn't know that ErrorLog can be piped into another program...

Either that, or I'm being really dumb and missing something obvious. :-)

Any help would be greatly appreciated.

from server-info:

Apache Server Information

Server Settings, mod_perl.c, mod_log_spread.c, mod_access.c, 
mod_rewrite.c, mod_info.c, mod_status.c, mod_mime.c, http_core.c

 OHHorizontalRule.pdf


Server Version: Apache/1.3.20 (Unix) mod_perl/1.26

--
-- Tom Mornini
-- InfoMania Printing  Prepress



Re: Odd problem with Perl sections

2001-10-24 Thread Scott Lanning

On Wed, 24 Oct 2001, Tom Mornini wrote:
1  Perl
2$ErrorLog = |/home/tmornini/Source/ewingz/bin/spread_from_stdin.pl ERROR;
3  /Perl

4  ErrorLog |/home/tmornini/Source/ewingz/bin/spread_from_stdin.pl ERROR
[snip]
When I use the Perl section (which I need to allow the path to
spread_from_stdin.pl to be dynamic at runtime) I receive this error:

[Wed Oct 24 09:52:25 2001] [error] Perl: ErrorLog takes one argument,
The filename of the error log

On line 4, you passed one argument delimited by quotation marks.
On line 2, you passed two arguments:
1) |/home/tmornini/Source/ewingz/bin/spread_from_stdin.pl
2) ERROR
so it seems you need to escape the space between them somehow
(I guess by a backslash, or put single quotes around the double
quotes, but I didn't test it).




Perl Sections: command_rec for directive `ISA' not found!

2001-05-09 Thread Jonathan Hilgeman

Seeing that nobody answered your question or posted the answer, I had to
overcome this same problem. The problem was the Perl libraries that were
installed (or not installed). You need to reinstall / install the
Bundle::DBI package and the correct modules for it. In my case, I was trying
to dynamically build VirtualHost directives from a mySQL database. I
telnetted/ssh to the shell and typed the following:

su-2.04#  perl -MCPAN -e shell

cpan install Bundle::DBI

 Bundle gets installed 

cpan install Msql-Mysql-modules-1.2216.tar.gz

 Package starts installing 

When it asked me if I wanted mSQL, mySQL, or both, I chose mySQL only. 
It asked me where the subdirectory with the include files was, and it
defaulted to /usr/local. This caught me off-guard because mySQL was actually
installed in /usr/local/mysql and so I kept putting that directory, but it
kept failing. When I tried reinstalling, I left it at /usr/local and it went
through fine. 

Now that the packages are installed, I had one more error to fix. In the
Perl section, I had:

$dbh = DBI-connect('DBI:mysql: ..blah..blah...');

which had to be changed to 

my $dbh = DBI-connect('DBI:mysql: ..blah..blah...');

Otherwise, Apache will not recognize the variables and will return an error
about commands and stuff.

Hope this helps!

Jonathan Hilgeman



RE: Perl Sections in Apache Config

2001-05-08 Thread Jonathan Hilgeman

Okay, in that case, would there be a way for Perl/Apache to read in info
from a mySQL database and dynamically update itself? Something like:

Perl
connect_to_db(info);
$resultrows = db_query(SELECT  FROM  WHERE  );
foreach($resultrows as $UserName)
{
$VirtualHost = .
}
/Perl

Can someone give me a good example of how to do that?
Thanks!

Jonathan

-Original Message-
From: Jonathan Hilgeman [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 07, 2001 5:36 PM
To: '[EMAIL PROTECTED]'
Subject: Perl Sections in Apache Config


Hi,
I've been trying to do this for some time but can't figure out how.
Basically I want a setup where anyone at www.UserName.domain.com or
UserName.domain.com will have their DocumentRoot set to
/www/httpd/html/UserName. So far I've tried this:

VirtualHost 111.111.111.111
UseCanonicalName Off
Perl

if($HTTP_HOST =~ s/(?:www\.)?(.*)\.domain\.com//g)
{
$VirtualDocumentRoot = /www/httpd/html/$1;
}
else
{
$VirtualDocumentRoot = '/www/httpd/html/%-3';
}

1;

/Perl

/VirtualHost

The second $VirtualDocumentRoot line works fine, but I NEED to be able to
get the first line to work instead, using Perl if possible.

Any guesses?

Jonathan



Re: Perl Sections in Apache Config

2001-05-08 Thread Philippe M \. Chiasson

On Mon, May 07, 2001 at 05:35:57PM -0700, Jonathan Hilgeman wrote:
 Hi,
 I've been trying to do this for some time but can't figure out how.
 Basically I want a setup where anyone at www.UserName.domain.com or
 UserName.domain.com will have their DocumentRoot set to
 /www/httpd/html/UserName. So far I've tried this:
 
 VirtualHost 111.111.111.111
   UseCanonicalName Off
   Perl
 
   if($HTTP_HOST =~ s/(?:www\.)?(.*)\.domain\.com//g)
   {
   $VirtualDocumentRoot = /www/httpd/html/$1;
   }
   else
   {
   $VirtualDocumentRoot = '/www/httpd/html/%-3';
   }
   
   1;
 
   /Perl
 
 /VirtualHost
 
 The second $VirtualDocumentRoot line works fine, but I NEED to be able to
 get the first line to work instead, using Perl if possible.
 
 Any guesses?

Your problem is that this code is evaluated at startup-time, not request-time.
So this means it will be run once globally, the regexp won't match and you just
configure the default.  There are many ways to do it.

First, look at mod_vhost_alias http://httpd.apache.org/docs/mod/mod_vhost_alias.html.
VirtualDocumentRoot /www/httpd/html/%0

Would map requests to www.username.com to /www/httpd/html/www.username.com
And for the username.com, you could simply use a symlink.  

Second, use mod_rewrite http://httpd.apache.org/docs/mod/mod_rewrite.html
Something like :

  RewriteEngine on
  RewriteCond   %{HTTP_HOST} ^(www\.)?[^.]+\.host\.com$
  RewriteRule   ^(.+)%{HTTP_HOST}$1  [C]
  RewriteRule   ^(www\.)?([^.]+)\.host\.com(.*) /www/httpd/html/$2$3

Third, you could do it in mod_perl with a custom handler

Perl
use Apache::Constants qw(:common);
sub My::MassVHosting::handler {
my $r = shift
if($r-header_in('Host') =~ /^(www\.)?([^.]+)\.domain,com/)
{
$r-filename(/home/httpd/html/$2);
$r-stat();
return OK;  
}
return Apache::Constants:;DECLINED;
}
/Perl
PerlTrancHandler My;;MassVHosting

For more information about mod_per magic, consider getting the book or reading the 
guide
http://perl.apache.org/guide/

Hope this helps.

P.S. I am not responsible for tyops ;-)
 Jonathan
 
 

-- 



Re: Perl Sections in Apache Config

2001-05-08 Thread will trillich

On Mon, May 07, 2001 at 09:32:23PM -0400, Philippe M . Chiasson wrote:
 On Mon, May 07, 2001 at 05:35:57PM -0700, Jonathan Hilgeman wrote:
  I've been trying to do this for some time but can't figure out how.

  VirtualHost 111.111.111.111
  UseCanonicalName Off
  Perl
  if($HTTP_HOST =~ s/(?:www\.)?(.*)\.domain\.com//g)
  {
  $VirtualDocumentRoot = /www/httpd/html/$1;
  }
  else
  {
  $VirtualDocumentRoot = '/www/httpd/html/%-3';
  }
  1;
  /Perl
  /VirtualHost

 Your problem is that this code is evaluated at startup-time, not request-time.
 So this means it will be run once globally, the regexp won't match and you just
 configure the default.  There are many ways to do it.
 
 First, look at mod_vhost_alias http://httpd.apache.org/docs/mod/mod_vhost_alias.html.
   VirtualDocumentRoot /www/httpd/html/%0
 
 Would map requests to www.username.com to /www/httpd/html/www.username.com
 And for the username.com, you could simply use a symlink.  
 
 Second, use mod_rewrite http://httpd.apache.org/docs/mod/mod_rewrite.html
 Something like :
 
   RewriteEngine on
   RewriteCond   %{HTTP_HOST} ^(www\.)?[^.]+\.host\.com$
   RewriteRule   ^(.+)%{HTTP_HOST}$1  [C]
   RewriteRule   ^(www\.)?([^.]+)\.host\.com(.*) /www/httpd/html/$2$3  
 
 Third, you could do it in mod_perl with a custom handler
 
 Perl
 use Apache::Constants qw(:common);
 sub My::MassVHosting::handler {
   my $r = shift
   if($r-header_in('Host') =~ /^(www\.)?([^.]+)\.domain,com/)

s/,/\\./

   {
   $r-filename(/home/httpd/html/$2);
   $r-stat();
   return OK;  
   }
   return Apache::Constants:;DECLINED;

s/;/:/

   }
 /Perl
 PerlTrancHandler My;;MassVHosting

s/;/:/g

 For more information about mod_per magic, consider getting the book or reading the 
guide
 http://perl.apache.org/guide/
 
 Hope this helps.
 
 P.S. I am not responsible for tyops ;-)

nice disclaimer... :)

-- 
don't visit this page. it's bad for you. take my expert word for it.
http://www.salon.com/people/col/pagl/2001/03/21/spring/index1.html

[EMAIL PROTECTED]
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!



Perl Sections in Apache Config

2001-05-07 Thread Jonathan Hilgeman

Hi,
I've been trying to do this for some time but can't figure out how.
Basically I want a setup where anyone at www.UserName.domain.com or
UserName.domain.com will have their DocumentRoot set to
/www/httpd/html/UserName. So far I've tried this:

VirtualHost 111.111.111.111
UseCanonicalName Off
Perl

if($HTTP_HOST =~ s/(?:www\.)?(.*)\.domain\.com//g)
{
$VirtualDocumentRoot = /www/httpd/html/$1;
}
else
{
$VirtualDocumentRoot = '/www/httpd/html/%-3';
}

1;

/Perl

/VirtualHost

The second $VirtualDocumentRoot line works fine, but I NEED to be able to
get the first line to work instead, using Perl if possible.

Any guesses?

Jonathan



Re: Perl Sections in Apache Config

2001-05-07 Thread Brian Burke

I'm running into a similiar issue, and I from what I've read,
mod_vhost_alias looks like it could help:
http://httpd.apache.org/docs/mod/mod_vhost_alias.html

Any comments on this mod?

Brian B.

- Original Message - 
From: Jonathan Hilgeman [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, May 07, 2001 8:35 PM
Subject: Perl Sections in Apache Config


 Hi,
 I've been trying to do this for some time but can't figure out how.
 Basically I want a setup where anyone at www.UserName.domain.com or
 UserName.domain.com will have their DocumentRoot set to
 /www/httpd/html/UserName. So far I've tried this:
 
 VirtualHost 111.111.111.111
 UseCanonicalName Off
 Perl
 
 if($HTTP_HOST =~ s/(?:www\.)?(.*)\.domain\.com//g)
 {
 $VirtualDocumentRoot = /www/httpd/html/$1;
 }
 else
 {
 $VirtualDocumentRoot = '/www/httpd/html/%-3';
 }
 
 1;
 
 /Perl
 
 /VirtualHost
 
 The second $VirtualDocumentRoot line works fine, but I NEED to be able to
 get the first line to work instead, using Perl if possible.
 
 Any guesses?
 
 Jonathan




rewrite rules in Perl sections

2001-04-04 Thread Francesc Guasch

Hi. I found and old thread about having rewrite rules inside
Perl sections in httpd.conf. In these mails it looks like there
is not an easy way to do this.
Is that still true ?

I've tried different guesses unsuccessfully:

$RewriteRule="^/(img/.*) http://other.server/$1";
$RewriteRule{"^/(img/.*)" } ="http://other.server/$1";
push @RewriteRule("^/(img/.*) http://other.server/$1");

any hints ?

-- 
 - frankie -



Perl Sections: command_rec for directive `ISA' not found!

2001-03-22 Thread Renaud Waldura

I recently upgraded a system to FreeBSD 4.2, Apache 1.3.19, mod_perl 1.25.
We use Perl sections to configure virtual hosts from a database; the vhosts
data is stored in a table, we select it with DBI and configure Apache from
within a Perl section.

This configuration process now fails with: "command_rec for directive `ISA'
not found! ". The error occurs on this statement:

$dbh = DBI-connect();

Any ideas?

--Renaud




New CPAN module to assist with Perl Sections

2001-03-16 Thread Kevin . Ruscoe

All

I have just uploaded Tie::DxHash v0.91 to CPAN.  Tie::DxHash 
preserves insertion order and allows duplicate keys.

What on earth for??  Well, this helps people who are using Perl 
Sections (particularly with mod_rewrite) to construct more complex 
rules.  The module's synopsis illustrates the point:

 use Tie::DxHash;
 my(%vhost);
 tie %vhost, 'Tie::DxHash' [, LIST];
 %vhost = (
   ServerName  = 'foo',
   RewriteCond = 'bar',
   RewriteRule = 'bletch',
   RewriteCond = 'phooey',
   RewriteRule = 'squelch',
 );

You can find some previous discussion of this point in this list's 
archive at
http://www.geocrawler.com/archives/3/182/2000/2/0/3371477/
For more information, see the module's POD.

Hope this helps you.  Any feedback gratefully accepted.

Regards
Kevin
$"="";print"@{[{sub{($i,$j,@_)=(1,1,split//,'hrP kc eeatenltarohsr 
u,J');
while(@_){foreach(1..$i){@_=(pop,@_)}push@t,shift;($i,$j)=($i+$j,$i)}@
t}}]}\n";

Anything which follows this line was added after I sent the mail.
=


Visit our website at http://www.ubswarburg.com

This message contains confidential information and is intended only 
for the individual named.  If you are not the named addressee you 
should not disseminate, distribute or copy this e-mail.  Please 
notify the sender immediately by e-mail if you have received this 
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free 
as information could be intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain viruses.  The sender therefore 
does not accept liability for any errors or omissions in the contents 
of this message which arise as a result of e-mail transmission.  If 
verification is required please request a hard-copy version.  This 
message is provided for informational purposes and should not be 
construed as a solicitation or offer to buy or sell any securities or 
related financial instruments.




Perl sections / Location problems

2001-02-14 Thread Michael J Schout

I've been scratching my head on this for quite a while and I cant seem to
figure it out.  I have a very stripped down configuration, which only contains
the following Perl section:

Perl
use Apache::Status;

$Location{"^/perl-status-1\$"} = {
  SetHandler  = 'perl-script',
  PerlHandler = 'Apache::Status'
};

$Location{"^/perl-status-2\$"} = {
  SetHandler  = 'perl-script',
  PerlHandler = 'Apache::Status'
};
/Perl

If I start the server up, it appears to configure correctly, however, if I
access /perl-status-1 I get a 404 Not Found error.  If I access /perl-status-2,
then I get the expected Apache::Status output.  This is very repeatable in that
no matter what I shove into the Location hash if its a regexp, the first entry
doesnt work.

I'm running Apache 1.3.17, mod_ssl 2.8.0, perl 5.6.0, Linux 2.2.16

Anyone have any ideas?

I ran the server with MOD_PERL_TRACE=all as:
httpd -X -f /nis.home/mschout/httpd.conf.bug

during startup, the perl trace output is as follows:

perl_parse args: '/dev/null' ...allocating perl interpreter...ok
constructing perl interpreter...ok
ok
running perl interpreter...ok
mod_perl: 0 END blocks encountered during server startup
loading perl module 'Apache'...loading perl module 'Apache::Constants::Exports'...ok
ok
loading perl module 'Tie::IxHash'...ok
perl_section: /Files
perl_section: Location ^/perl-status-1$
init `PerlHandler' stack
perl_cmd_push_handlers: @PerlHandler, 'Apache::Status'
pushing `Apache::Status' into `PerlHandler' handlers
PerlHandler Apache::Status (OK) Limit=no
SetHandler perl-script (OK) Limit=no
perl_section: Location ^/perl-status-2$
init `PerlHandler' stack
perl_cmd_push_handlers: @PerlHandler, 'Apache::Status'
pushing `Apache::Status' into `PerlHandler' handlers
PerlHandler Apache::Status (OK) Limit=no
SetHandler perl-script (OK) Limit=no
perl_section: /Location
perl_section: /Files
perl_section: /Location
perl_section: /Directory
perl_section: /Directory
perl_section: /VirtualHost
.


At request time, this is what appears in the error_log
`PerlInitHandler' push_handlers() stack is empty
PerlInitHandler handlers returned -1
`PerlPostReadRequestHandler' push_handlers() stack is empty
PerlPostReadRequestHandler handlers returned -1
`PerlTransHandler' push_handlers() stack is empty
PerlTransHandler handlers returned -1
`PerlInitHandler' push_handlers() stack is empty
PerlInitHandler handlers returned -1
`PerlHeaderParserHandler' push_handlers() stack is empty
PerlHeaderParserHandler handlers returned -1
`PerlAccessHandler' push_handlers() stack is empty
PerlAccessHandler handlers returned -1
`PerlTypeHandler' push_handlers() stack is empty
PerlTypeHandler handlers returned -1
`PerlFixupHandler' push_handlers() stack is empty
PerlFixupHandler handlers returned -1
[Wed Feb 14 15:18:38 2001] [error] [client 209.246.133.20] File does not exist: 
/nis.home/mschout/dev/gkgdrs/gkgweb/html/perl-status-1
`PerlLogHandler' push_handlers() stack is empty
PerlLogHandler handlers returned -1


and running under strace, this is what we see during the request:
write(2, "`PerlInitHandler\' push_handlers("..., 49) = 49
write(2, "PerlInitHandler handlers returne"..., 37) = 37
write(2, "`PerlPostReadRequestHandler\' pus"..., 60) = 60
write(2, "PerlPostReadRequestHandler handl"..., 48) = 48
write(2, "`PerlTransHandler\' push_handlers"..., 50) = 50
write(2, "PerlTransHandler handlers return"..., 38) = 38
stat("/nis.home/mschout/dev/gkgdrs/gkgweb/html/perl-status-1", 0xb6dc) = -1 ENOENT 
(No such file or directory)
stat("/nis.home/mschout/dev/gkgdrs/gkgweb/html", {st_mode=S_IFDIR|S_ISGID|0775, 
st_size=3072, ...}) = 0
open("/.htaccess", O_RDONLY)= -1 ENOENT (No such file or directory)
open("/nis.home/.htaccess", O_RDONLY)   = -1 ENOENT (No such file or directory)
open("/nis.home/mschout/.htaccess", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/nis.home/mschout/dev/.htaccess", O_RDONLY) = -1 ENOENT (No such file or 
directory)
open("/nis.home/mschout/dev/gkgdrs/.htaccess", O_RDONLY) = -1 ENOENT (No such file or 
directory)
open("/nis.home/mschout/dev/gkgdrs/gkgweb/.htaccess", O_RDONLY) = -1 ENOENT (No such 
file or directory)
open("/nis.home/mschout/dev/gkgdrs/gkgweb/html/.htaccess", O_RDONLY) = 4
fstat(4, {st_mode=S_IFREG|0664, st_size=194, ...}) = 0
fstat(4, {st_mode=S_IFREG|0664, st_size=194, ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x40018000
read(4, "#\n# $Id: .htaccess,v 1.13 2000/1"..., 4096) = 194
read(4, "", 4096)   = 0
close(4)= 0
munmap(0x40018000, 4096)= 0
write(2, "`PerlInitHandler\' push_handlers("..., 49) = 49
write(2, "PerlInitHandler handlers returne"..., 37) = 37
write(2, "`PerlHeaderParserHandler\' push_h"..., 57) = 57
write(2, "PerlHeaderParserHandler handlers"..., 45) = 45
write(2, "`PerlAccessHandler\' push_handler"..., 51) = 51
write(2, "PerlAccessHandler handlers retur"..., 39) = 39
write(2, 

Re: problems with %Location inside perl-sections

2001-02-13 Thread Stas Bekman

On Mon, 12 Feb 2001, Marc Lehmann wrote:

 On Mon, Feb 12, 2001 at 08:48:57AM +0800, Stas Bekman [EMAIL PROTECTED] wrote:
  Looks like Apache doing stat() calls problem. Try to run the request under
  strace(1) or truss(1). See:
  http://perl.apache.org/guide/performance.html#Reducing_the_Number_of_stat_Ca

 this is with perl-status:

 [pid 14461] stat("/tmp/perl-status", 0xb3cc) = -1 ENOENT (No such file or 
directory)
 [pid 14461] stat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=3505, ...}) = 0
 [pid 14461] open("/.htaccess", O_RDONLY) = -1 ENOENT (No such file or directory)
 [pid 14461] open("/tmp/.htaccess", O_RDONLY) = -1 ENOENT (No such file or directory)

 and this is the same as with /test when there is no /tmp/test. With an
 existing /tmp/test, I get:

 [pid 14460] stat("/tmp/test", {st_mode=S_IFDIR|0755, st_size=35, ...}) = 0
 [pid 14460] open("/.htaccess", O_RDONLY) = -1 ENOENT (No such file or directory)
 [pid 14460] open("/tmp/.htaccess", O_RDONLY) = -1 ENOENT (No such file or directory)
 [pid 14460] open("/tmp/test/.htaccess", O_RDONLY) = -1 ENOENT (No such file or 
directory)

Seems OK to me. I cannot reproduce your problem on my setup. The only
difference I have is that I have 'Options None' so I don't get the
.htaccess lookup.

  $Location{'/admin'} = { ... };
  $Location{'^/admin'} = { ... };
 
  Again, what strace tells you?

 apache is stat()'ing the path as long as it can, i.e. until
 .../cgi-bin/printenv oder . (there is no /admin directory in my
 DocumentRoot).

  You will see everything that Apache does
  while looking at the output.

 I couldn't try with PerlTransHandler yet (since I seem to have left this
 out when compiling mod_perl), but my question is: does this also fix the
 problems I encounter? I am not concerned about speed here, but rather
 about correctness, namely that I need ^/admin which shouldn't match at all
 in a Location directive.

What happens if you don't use CPerl sections and just a normal Apache
config? Also it's possible that you mix-up name spaces, so Apache gets the
wrong location matched. You can see the docs about that in guide's config
chapter or in Apache manual. If that's the problem.

 Thanks a lot for your reply!

 --
   -==- |
   ==-- _   |
   ---==---(_)__  __   __   Marc Lehmann  +--
   --==---/ / _ \/ // /\ \/ /   [EMAIL PROTECTED]  |e|
   -=/_/_//_/\_,_/ /_/\_\   XX11-RIPE --+
 The choice of a GNU generation   |
  |




_
Stas Bekman  JAm_pH --   Just Another mod_perl Hacker
http://stason.org/   mod_perl Guide  http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://logilune.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/






problems with %Location inside perl-sections

2001-02-11 Thread Marc Lehmann

I have two problems related to setting Location directives from within
perl sections that I don't understand (I've looked at the mod_perl guide
and the archive but a RTFM is certainly welcome ;)

First problem: Location works on url space only while $Location
requires existing directories (full httpd.conf atatched):

   DocumentRoot /tmp

   Location /perl-status
  SetHandler perl-script
  PerlHandler Apache::Status
   /Location

   Perl
  $Location{'/test'} = {
 SetHandler = 'perl-script',
 PerlHandler = "Apache::Status",
  };
   /Perl

The first location works fine. The second one doesn't UNTIL I mkdir
/tmp/test (there is no /tmp/perl-status), after which I get the
perl-status page on both urls.

The second problem (which I can't reproduce with a small example) is that,
when using a lot of entries in %Location, they suddenly start to behave
like LocationMatch, i.e.:

   $Location{'/admin'} = { ... };

matches /test/admin, /something/else/admin/jump, /cgi-bin/printenv/admin
and everything else that contains /admin IFF the url does not directly
point to something hat can be displayed (e.g. the printenv is a cgi script
but it doesn't get called).

If I change this to:

   $Location{'^/admin'} = { ... };

it suddenly starts to work as expected, indeed as if LocationMatch was
used. However, this is not deterministic. Sometimes the above simply
matches nothing ;)

Does this ring a bell for somebody? I ahd the same problem with
apache-1.3.14 and mod_perl-1.24 I upgraded to apache-1.3.17 and modperl
from cvs but the symptoms didn't change so I guess it might not be a bug
but rather some misunderstanding on my side :(

-- 
  -==- |
  ==-- _   |
  ---==---(_)__  __   __   Marc Lehmann  +--
  --==---/ / _ \/ // /\ \/ /   [EMAIL PROTECTED]  |e|
  -=/_/_//_/\_,_/ /_/\_\   XX11-RIPE --+
The choice of a GNU generation   |
 |


ServerType standalone
PerlFreshRestart off
HostnameLookups off

User nobody
Group nobody

ServerName doom.laendle
ServerRoot /tmp
DocumentRoot /tmp
Port 81

PerlModule Apache::Status

Location /perl-status
   SetHandler perl-script
   PerlHandler Apache::Status
/Location

Perl
   $Location{'/test'} = {
  SetHandler = 'perl-script',
  PerlHandler = "Apache::Status",
   };
/Perl





Re: problems with %Location inside perl-sections

2001-02-11 Thread Stas Bekman

On Sun, 11 Feb 2001, Marc Lehmann wrote:

 I have two problems related to setting Location directives from within
 perl sections that I don't understand (I've looked at the mod_perl guide
 and the archive but a RTFM is certainly welcome ;)
 
 First problem: Location works on url space only while $Location
 requires existing directories (full httpd.conf atatched):
 
DocumentRoot /tmp
 
Location /perl-status
   SetHandler perl-script
   PerlHandler Apache::Status
/Location
 
Perl
   $Location{'/test'} = {
  SetHandler = 'perl-script',
  PerlHandler = "Apache::Status",
   };
/Perl
 
 The first location works fine. The second one doesn't UNTIL I mkdir
 /tmp/test (there is no /tmp/perl-status), after which I get the
 perl-status page on both urls.

Looks like Apache doing stat() calls problem. Try to run the request under
strace(1) or truss(1). See:
http://perl.apache.org/guide/performance.html#Reducing_the_Number_of_stat_Ca
 
 The second problem (which I can't reproduce with a small example) is that,
 when using a lot of entries in %Location, they suddenly start to behave
 like LocationMatch, i.e.:
 
$Location{'/admin'} = { ... };
 
 matches /test/admin, /something/else/admin/jump, /cgi-bin/printenv/admin
 and everything else that contains /admin IFF the url does not directly
 point to something hat can be displayed (e.g. the printenv is a cgi script
 but it doesn't get called).
 
 If I change this to:
 
$Location{'^/admin'} = { ... };
 
 it suddenly starts to work as expected, indeed as if LocationMatch was
 used. However, this is not deterministic. Sometimes the above simply
 matches nothing ;)
 
 Does this ring a bell for somebody? I ahd the same problem with
 apache-1.3.14 and mod_perl-1.24 I upgraded to apache-1.3.17 and modperl
 from cvs but the symptoms didn't change so I guess it might not be a bug
 but rather some misunderstanding on my side :(

Again, what strace tells you? You will see everything that Apache does
while looking at the output. 

_
Stas Bekman  JAm_pH --   Just Another mod_perl Hacker
http://stason.org/   mod_perl Guide  http://perl.apache.org/guide 
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://logilune.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/  





Re: problems with %Location inside perl-sections

2001-02-11 Thread Marc Lehmann

On Mon, Feb 12, 2001 at 08:48:57AM +0800, Stas Bekman [EMAIL PROTECTED] wrote:
 Looks like Apache doing stat() calls problem. Try to run the request under
 strace(1) or truss(1). See:
 http://perl.apache.org/guide/performance.html#Reducing_the_Number_of_stat_Ca

this is with perl-status:

[pid 14461] stat("/tmp/perl-status", 0xb3cc) = -1 ENOENT (No such file or 
directory)
[pid 14461] stat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=3505, ...}) = 0
[pid 14461] open("/.htaccess", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 14461] open("/tmp/.htaccess", O_RDONLY) = -1 ENOENT (No such file or directory)

and this is the same as with /test when there is no /tmp/test. With an
existing /tmp/test, I get:

[pid 14460] stat("/tmp/test", {st_mode=S_IFDIR|0755, st_size=35, ...}) = 0
[pid 14460] open("/.htaccess", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 14460] open("/tmp/.htaccess", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 14460] open("/tmp/test/.htaccess", O_RDONLY) = -1 ENOENT (No such file or 
directory)

 $Location{'/admin'} = { ... };
 $Location{'^/admin'} = { ... };
 
 Again, what strace tells you?

apache is stat()'ing the path as long as it can, i.e. until
.../cgi-bin/printenv oder . (there is no /admin directory in my
DocumentRoot).

 You will see everything that Apache does
 while looking at the output. 

I couldn't try with PerlTransHandler yet (since I seem to have left this
out when compiling mod_perl), but my question is: does this also fix the
problems I encounter? I am not concerned about speed here, but rather
about correctness, namely that I need ^/admin which shouldn't match at all
in a Location directive.

Thanks a lot for your reply!

-- 
  -==- |
  ==-- _   |
  ---==---(_)__  __   __   Marc Lehmann  +--
  --==---/ / _ \/ // /\ \/ /   [EMAIL PROTECTED]  |e|
  -=/_/_//_/\_,_/ /_/\_\   XX11-RIPE --+
The choice of a GNU generation   |
 |



Perl Sections, NameVirtualHost, and Aliases

2001-02-07 Thread Veatch, David W

Yo,

Has anyone successfully built a fully perl conf file with multiple virtual
hosts on the same IP?  I'm giving it my best, but just can't quite get it to
work.  I'm stuck on aliases.  The Eagle book and the mod_perl guide have
both been of great help getting this far, but I can't find an example of
setting anything where "Directive is Repeated Multiple Times" (which may be
an indication that it just don't work).  I just started on this project, and
this is the first major roadblock.  Here are the relevant portions (I hope)
of the config for reference.  Thank you in advance for any and all
help/clues.  This is getting deeper than I've previously gotten, so I'm
learning as I go.  An RTFM is welcome, just tell me which M and where. :)

Perl
#!/usr/local/bin/perl
# Trimmed for brevity here... the real file is MUCH larger

$Apache::Server::StrictPerlSections = 1;
$Apache::Server::SaveConfig = 1;

$ServerName = `hostname`;
$ServerType = 'standalone';
$ServerRoot = '/www';

my $conf_root = $ServerRoot . '/conf';
my $logs_root = $ServerRoot . '/logs';
my $vhosts_root = $ServerRoot . '/vhosts';

# olorin eq prod, erasmus eq dev
if ($ServerName =~ /olorin/) { 
$NameVirtualHost = '192.168.0.3'; 
}
elsif ($ServerName =~ /erasmus/) { 
$NameVirtualHost = '192.168.0.2'; 
}

my $NameVirtualHostIP = $NameVirtualHost . ':80';

$KeepAlive = 'Off';
$ExtendedStatus = 'On';
$UseCanonicalName = 'Off';
$HostnameLookups = 'Off';
$LogLevel = 'warn';

$VirtualHost{$NameVirtualHostIP} = [
# WWW.ACQUISITIONS.ORG
{
ServerName = 'www.acquisitions.org',
ServerAlias = 'acquisitions.org',
DocumentRoot = "$vhosts_root/www.acquisitions.org/htdocs",
ScriptAlias = [
'/cgi-bin/' = "$vhosts_root/www.acquisitions.org/cgi-bin/" 
],
CustomLog = "$logs_root/www.acquisitions.org_access_log combined",
ErrorLog = "$logs_root/www.acquisitions.org_error_log",
},
# MEMBERS.RECKONING.ORG
{
ServerName = 'members.reckoning.org',
Alias = {
[ '/images' = "$vhosts_root/members.reckoning.org/images"
],
[ '/css' = "$vhosts_root/members.reckoning.org/css" ],
},
ErrorLog = "$logs_root/members.reckoning.org_error_log",
TransferLog = "$logs_root/members.reckoning.org_access_log",

PerlAuthenHandler = 'Apache::AuthDBI::authen',
PerlSetVar = {
Auth_DBI_data_source = 'dbi:Pg:dbname=reckdb',
Auth_DBI_username = 'dvicci',
Auth_DBI_pwd_table = 'user_profile',
Auth_DBI_uid_field = 'user_username',
Auth_DBI_pwd_field  = 'user_password',
Auth_DBI_pwd_whereclause = '"user_usertype0"',
Auth_DBI_encrypted = 'off',
},
Location = {
'/' = {
SetHandler = 'perl-script',
PerlInitHandler = 'Apache::StatINC',
PerlHandler = 'Reckoning::IndexHandler::members',

AuthName = 'theReckoning',
AuthType = 'Basic',
Limit = {
'GET POST' = {
require = 'valid-user',
},
},
},
'/images' = {
SetHandler = 'default-handler',
},
'/css' = {
SetHandler = 'default-handler',
},
'/Error' = {
SetHandler = 'perl-script',
PerlHandler = 'Reckoning::Error',
},
'/LoginError' = {
SetHandler = 'perl-script',
PerlHandler = 'Reckoning::LoginError',
},
},
ErrorDocument = {
'401' = '/LoginError',
}
},
# WWW.RECKONING.ORG
{
ServerName = 'www.reckoning.org',
ServerAlias = 'reckoning.org',
Alias = {
[ '/images' = "$vhosts_root/members.reckoning.org/images"
],
[ '/css' = "$vhosts_root/members.reckoning.org/css" ],
},
ErrorLog = "$logs_root/www.reckoning.org_error_log",
TransferLog = "$logs_root/www.reckoning.org_access_log",
Location = {
'/' = {
SetHandler = 'perl-script',
PerlInitHandler = 'Apache::StatINC',
PerlHandler = 'Reckoning::IndexHandler::www',
},
'/images' = {
SetHandler = 'default-handler',
},
'/css' = {
SetHandler = 'default-handler',
},
'/Error' = {
SetHandler = 'perl-script',
PerlHandler = 'Reckoning::Error',
},

Re: Perl Sections, NameVirtualHost, and Aliases

2001-02-07 Thread G.W. Haywood

Hi there,

On Wed, 7 Feb 2001, Veatch, David W wrote:

 Has anyone successfully built a fully perl conf file with multiple virtual
 hosts on the same IP?

Dunno if it will work for you in those circumstances, but have you
looked at mod_macro?  I used it last year and it was fine for an
ordinary (although complex, multiple virtual hosts) http.conf.

73,
Ged.




RE: Perl Sections, NameVirtualHost, and Aliases

2001-02-07 Thread Veatch, David W

I haven't no, but I will.  I'm doing this at home in preparation for
implementing it at work, where I hesitate to throw yet another module into
the mix (we already have a pretty rich set of compile time modules in
there).

Thanks! :)

 From: G.W. Haywood [EMAIL PROTECTED]

 Dunno if it will work for you in those circumstances, but have you
 looked at mod_macro?  I used it last year and it was fine for an
 ordinary (although complex, multiple virtual hosts) http.conf.



Re: Perl Sections, NameVirtualHost, and Aliases

2001-02-07 Thread Jason Terry

I use this code to pull my domains from a VERY simple mySQL db


- Original Message - 
From: "G.W. Haywood" [EMAIL PROTECTED]
To: "Veatch, David W" [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, February 07, 2001 10:04 AM
Subject: Re: Perl Sections, NameVirtualHost, and Aliases


 Hi there,
 
 On Wed, 7 Feb 2001, Veatch, David W wrote:
 
  Has anyone successfully built a fully perl conf file with multiple virtual
  hosts on the same IP?
 
 Dunno if it will work for you in those circumstances, but have you
 looked at mod_macro?  I used it last year and it was fine for an
 ordinary (although complex, multiple virtual hosts) http.conf.
 
 73,
 Ged.

 virt_perl.inc


RE: Perl Sections, NameVirtualHost, and Aliases

2001-02-07 Thread Veatch, David W

That did it!  The aliases problem is solved!  Thanks!

Before:
Alias = {
[ '/images' = "$vhosts_root/domain/images" ],
[ '/css' = "$vhosts_root/domain/css" ],
}

Now:
Alias = [
[ '/images' = "$vhosts_root/domain/images" ],
[ '/css' = "$vhosts_root/domain/css" ],
]


Now I've got to figure out what's going on with authentication... it's not
picking up the auth vars.  But with the Alias problem fixed, I'm feeling
much better about it.  Thanks!

Perhaps an Alias example could be added to the docs somewhere?

 -Original Message-
 From: Jason Terry [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, February 07, 2001 11:53 AM
 To: G.W. Haywood; Veatch, David W
 Cc: [EMAIL PROTECTED]
 Subject: Re: Perl Sections, NameVirtualHost, and Aliases
 
 
 I use this code to pull my domains from a VERY simple mySQL db



Re: Perl Sections, NameVirtualHost, and Aliases

2001-02-07 Thread Benjamin Trott

I think that this:

 PerlSetVar = {
 Auth_DBI_data_source = 'dbi:Pg:dbname=reckdb',
 Auth_DBI_username = 'dvicci',
 Auth_DBI_pwd_table = 'user_profile',
 Auth_DBI_uid_field = 'user_username',
 Auth_DBI_pwd_field  = 'user_password',
 Auth_DBI_pwd_whereclause = '"user_usertype0"',
 Auth_DBI_encrypted = 'off',
 },

should look more like this:

PerlSetVar = [
[ Auth_DBI_data_source = 'dbi:Pg:dbname=reckdb' ],
[ Auth_DBI_username = 'dvicci' ],
[ Auth_DBI_pwd_table = 'user_profile' ],
[ Auth_DBI_uid_field = 'user_username' ],
[ Auth_DBI_pwd_field  = 'user_password' ],
[ Auth_DBI_pwd_whereclause = '"user_usertype0"' ],
[ Auth_DBI_encrypted = 'off' ],
],

That's the format I use when using PerlSetVar.

bye,
Ben




Re: Perl Sections, NameVirtualHost, and Aliases

2001-02-07 Thread Benjamin Trott

 However, now I'm getting this:
 
 Perl: PerlSetVar takes two arguments, Perl config var and value.

I don't think PerlSetVar likes this line:

[ Auth_DBI_pwd_whereclause = '"user_usertype0"' ],

You could try taking out the quotes and see if that helps, cause it did for
me (though I didn't check whether the correct var got set):

[ Auth_DBI_pwd_whereclause = 'user_usertype0' ],

bye,
Ben




RE: Perl Sections, NameVirtualHost, and Aliases

2001-02-07 Thread Veatch, David W

Yup... you and I came to the same conclusion at the same time.  I can't tell
if the var is truly being set, though, b/c AuthType, AuthName, or Limit vars
aren't being set...  My handler requires that $r-current_user be set, and
so it's bombing out.  On another vhost that doesn't require current_user,
it's getting through just fine, but w/o prompting for authentication.

Thanks again.  I feel like I'm getting closer and closer, and that's a Good
Thing. :)

] David - still busily pecking.

 -Original Message-
 From: Benjamin Trott [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, February 07, 2001 12:38 PM
 To: Veatch, David W
 Cc: [EMAIL PROTECTED]
 Subject: Re: Perl Sections, NameVirtualHost, and Aliases
 
 
  However, now I'm getting this:
  
  Perl: PerlSetVar takes two arguments, Perl config var and value.
 
 I don't think PerlSetVar likes this line:
 
 [ Auth_DBI_pwd_whereclause = '"user_usertype0"' ],



RE: Perl Sections, NameVirtualHost, and Aliases

2001-02-07 Thread Veatch, David W

Got it.  So far, everything appears to be working like a dream.  Here's the
changes I made:

# OLD and BREAKY

Location = {
'/' = {
SetHandler = 'perl-script',
PerlInitHandler = 'Apache::StatINC',
PerlHandler = 'Reckoning::IndexHandler::members',

AuthName = 'theReckoning',
AuthType = 'Basic',
Limit = {
'GET POST' = {
require = 'valid-user',
},
},
},
},

# SHINY and NEW

Location = {
'/' = {
SetHandler = 'perl-script',
PerlInitHandler = 'Apache::StatINC',
PerlHandler = 'Reckoning::IndexHandler::members',
AuthName = qw( theReckoning ),
AuthType = 'Basic',
require = 'valid-user',
},
},

Now, if you want to use the LIMIT directive for something, then I'm not sure
how to get that to work... I realized that I didn't really need it, yanked
it, and all is well.



Re: Perl Sections, NameVirtualHost, and Aliases

2001-02-07 Thread Dave Baker

 Has anyone successfully built a fully perl conf file with multiple virtual
 hosts on the same IP?  I'm giving it my best, but just can't quite get it to
 work.  I'm stuck on aliases.  The Eagle book and the mod_perl guide have
 both been of great help getting this far, but I can't find an example of
 setting anything where "Directive is Repeated Multiple Times" (which may be
 an indication that it just don't work).

Not a direct answer, but an alternative to fighting with the data
structure is just just plug a programmatic $PerlConfig .= $string and
build the VirtualHosts as if they were plain text.

Not as elegant as doing this the hard way, but it's also easier to
explain if you have to hand the config file off to someone who knows
Apache but not Perl.


Dave 

-- 

-  Dave Baker  :  [EMAIL PROTECTED]  :  [EMAIL PROTECTED]  :  http://dsb3.com/
GnuPG: 1024D/D7BCA55D / 09CD D148 57DE 711E 6708  B772 0DD4 51D5 D7BC A55D


 PGP signature


Re: Perl Sections, NameVirtualHost, and Aliases

2001-02-07 Thread Wade Burgett

This is working for me.  I do some aliasing of mod_perl directories outside
of the perl section for stuff that all my hosts need to share so my httpd.conf
is not all perl, but I do have some aliasing going on.

There's some stuff there to pull my records out of a database but basically
the $Company hash_ref is for each company I host.


Perl
use Asql::utility;
use Apache::PerlSections();
my $statement = "select ID,Company,webhost,rootdir,master_user,domain,rt from
Companies where webhost is not  NULL and master_user is not NULL";
my $dbh = connect_system_db();
my $sth = $dbh-prepare($statement)|| die "$DBI::errstr\n";
$sth-execute()|| die "$DBI::errstr\n";
my $counter = 0;

while ($Company = $sth-fetchrow_hashref()){

$$Company{ServerAdmin} = "$$Company{master_user}\@"."$$Company{domain}";
my $statement = "select Domain from domains where CompanyID=?";
my $sth2 = $dbh-prepare($statement)|| die "$DBI::errstr\n";
$sth2-execute($$Company{ID})|| die "$DBI::errstr\n";
my $othersites = $sth2-fetchall_arrayref;
@$othersites = map {$_="www.$_";} @$othersites;
#build the hosts

$VirtualHost{'192.168.0.50:80'}[$counter] = {
 SSLDisable   = '',
 ServerName   = "$$Company{webhost}",
 DocumentRoot = "$$Company{rootdir}/public_html",
 ErrorLog = "$$Company{rootdir}/log/error.log",
 CustomLog  = "$$Company{rootdir}/log/access.log combined",
 ServerAdmin  = "$$Company{ServerAdmin}",
 CheckSpelling = 'on',
 "ErrorDocument 404" = "/errors/404.shtml",
 Alias = ["/webrt" = "/var/burgettsys/rt/lib/images"],
 ScriptAlias = ["/rt" = "$$Company{rootdir}/rt/bin/cgi/"],
 ServerAlias = $othersites,
};
$counter++;
};

#print STDERR Apache::PerlSections-dump();
__END__

/Perl



Dave Baker wrote:

  Has anyone successfully built a fully perl conf file with multiple virtual
  hosts on the same IP?  I'm giving it my best, but just can't quite get it to
  work.  I'm stuck on aliases.  The Eagle book and the mod_perl guide have
  both been of great help getting this far, but I can't find an example of
  setting anything where "Directive is Repeated Multiple Times" (which may be
  an indication that it just don't work).

 Not a direct answer, but an alternative to fighting with the data
 structure is just just plug a programmatic $PerlConfig .= $string and
 build the VirtualHosts as if they were plain text.

 Not as elegant as doing this the hard way, but it's also easier to
 explain if you have to hand the config file off to someone who knows
 Apache but not Perl.

 Dave

 --

 -  Dave Baker  :  [EMAIL PROTECTED]  :  [EMAIL PROTECTED]  :  http://dsb3.com/
 GnuPG: 1024D/D7BCA55D / 09CD D148 57DE 711E 6708  B772 0DD4 51D5 D7BC A55D

   
Part 1.2Type: application/pgp-signature

--
Wade Burgett
Burgett Systems
http://www.burgettsys.com/
[EMAIL PROTECTED]






Localizing Perl sections to VHosts

2000-12-22 Thread Todd Finney

I'm trying to move my VHost-specific libraries into more 
logical directories (for me).  I have a number of them, and 
I'd rather not just use them all in my startup.pl - mostly 
because of concern over name collisions 
(Site1::connect_to_db(), Site2::connect_to_db()).

If I use this in a VirtualHost section in  my httpd.conf:

Perl
use lib('/www/mylibs');
/Perl

libraries under /www/mylibs/ are available to all 
VirtualHosts, at least as far as I can tell.  Is there a 
way to make the directive apply to only a single 
VirtualHost, or another way to do this?


thanks,
Todd






Re: Localizing Perl sections to VHosts

2000-12-22 Thread Stas Bekman

On Fri, 22 Dec 2000, Todd Finney wrote:

 I'm trying to move my VHost-specific libraries into more 
 logical directories (for me).  I have a number of them, and 
 I'd rather not just use them all in my startup.pl - mostly 
 because of concern over name collisions 
 (Site1::connect_to_db(), Site2::connect_to_db()).
 
 If I use this in a VirtualHost section in  my httpd.conf:
 
 Perl
   use lib('/www/mylibs');
 /Perl
 
 libraries under /www/mylibs/ are available to all 
 VirtualHosts, at least as far as I can tell.  Is there a 
 way to make the directive apply to only a single 
 VirtualHost, or another way to do this?

http://perl.apache.org/guide/config.html#Is_There_a_Way_to_Modify_INC_on


_
Stas Bekman  JAm_pH --   Just Another mod_perl Hacker
http://stason.org/   mod_perl Guide  http://perl.apache.org/guide 
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://logilune.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/  





Files .. in virtualhosts in perl sections

2000-11-16 Thread Tom Lancaster

Anyone have any experience doing Files sections inside of perlsections virtualhosts.
I can't see anything in the docs about this. 
Just wanted to ask before I start experimenting, as I don't have the first clue about 
how this syntax might work.

Thanks,

-- 
Tom Lancaster   Red Hat, Inc.
Web Engineer(415) 777-9810 x 228



Re: Files .. in virtualhosts in perl sections

2000-11-16 Thread Benjamin Trott

 Anyone have any experience doing Files sections inside of perlsections
 virtualhosts.
 I can't see anything in the docs about this.
 Just wanted to ask before I start experimenting, as I don't have the first
 clue about how this syntax might work.

Assuming I'm not missing something subtle about Files blocks vs. Location
blocks--I've done the latter, not the former--you can just assign your Files
key a hashref:

push @{ $VirtualHosts{$IP} }, {
Files = {
'/foo' = {
SetHandler  = 'perl-script',
PerlHandler = 'Foo',
},
},
};

And so on. I use "push" instead of direct assignment because it allows for
multiple named virtual hosts.

bye,
Ben




Bizarre Perl Sections Problem

2000-10-21 Thread Benjamin Trott

I'm having a really strange (in my opinion) problem with Perl sections and
using the Apache::ReadConfig namespace explicitly (qualifying variables,
like %Apache::ReadConfig::Location). Here's what I'm doing: I have a small
library of routines; I'm using PerlRequire to load that library. In a Perl
section, I'm then calling a routine from that library that should alter
%Apache::ReadConfig::Location. When I dump out the ReadConfig namespace,
though (using PerlSections-dump), there's nothing in %Location.

*However*, and this is the weird part, this only happens if I don't have a
Perl section before the PerlRequire statement. This will be demonstrated
below.

I have a small test case. Here's the library, called 'foo.pl':

package Foo;

sub bar {
$Apache::ReadConfig::Location{"/foo"} = {
Options = 'ExecCGI',
};
}

1;

Here's the relevant portion of my httpd.conf, where the PerlRequire is
before the first Perl section:

PerlRequire conf/foo.pl

Perl
use Apache::PerlSections;
Foo::bar();
print STDERR Apache::PerlSections-dump;
/Perl

Here's the output of starting up the webserver with that configuration file
(I compiled with PERL_TRACE on):

PerlRequire: arg=`conf/foo.pl'
attempting to require `conf/foo.pl'
loading perl module 'Apache'...ok
loading perl module 'Apache::Constants::Exports'...ok
loading perl module 'Tie::IxHash'...ok
perl_section: /Files
perl_section: /Directory
perl_section: /Files
perl_section: /Directory
perl_section: /VirtualHost
perl_section: /Location
perl_section: /Location
loading perl module 'Apache'...ok
loading perl module 'Tie::IxHash'...ok
package Apache::ReadConfig;
#scalars:

#arrays:

#hashes:

1;
__END__
perl_section: /Files
perl_section: /Directory
perl_section: /Files
perl_section: /Directory
perl_section: /VirtualHost
perl_section: /Location
perl_section: /Location

Nothing in the Apache::ReadConfig namespace, as you can see.

Now, here's the *working* webserver configuration, with a (blank) Perl
section coming before the PerlRequire:

Perl
/Perl

PerlRequire conf/foo.pl

Perl
use Apache::PerlSections;
Foo::bar();
print STDERR Apache::PerlSections-dump;
/Perl

And here's the output:

loading perl module 'Apache'...ok
loading perl module 'Apache::Constants::Exports'...ok
loading perl module 'Tie::IxHash'...ok
perl_section: /Files
perl_section: /Directory
perl_section: /Files
perl_section: /Directory
perl_section: /VirtualHost
perl_section: /Location
perl_section: /Location
PerlRequire: arg=`conf/foo.pl'
attempting to require `conf/foo.pl'
loading perl module 'Apache'...ok
loading perl module 'Tie::IxHash'...ok
package Apache::ReadConfig;
#scalars:

#arrays:

#hashes:

%Location = (
  '/foo' = {
'Options' = 'ExecCGI'
  }
);

1;
__END__
perl_section: /Files
perl_section: /Directory
perl_section: /Files
perl_section: /Directory
perl_section: /VirtualHost
perl_section: /Location
perl_section: Location /foo
Options ExecCGI (OK) Limit=no
perl_section: /Location

In other words, it works as expected when the blank Perl section is added
before the PerlRequire. So what seems to be happening--and I don't know the
internals side of this, so I'm just making guesses--is that the first Perl
section initializes the Apache::ReadConfig namespace, including the
%Location hash. Without this initialization, an explicit use of
%Apache::ReadConfig::Location seems to be... broken.

And that's as far as I can go with it. :)

So what I'd really like, if possible, is an explanation for this behavior;
adding the blank Perl section seems to provide a useable workaround, but I'd
like to know *why* this is happening.

Thanks all.

bye,
Benjamin Trott




Apache Perl Sections Woes

2000-10-06 Thread Carlos Ramirez

I'm trying to configure my Apache config file using Perl Sections. I'm
stuck in trying to populate a Directory directive with a bunch of "Allow
from"s like so:

## Get my "allow froms" from an existing list of ip addresses
 my $accessfile =
'/usr/local/etc/apache_1.3.12/conf/accesscontrol.conf';
open ACCESS, $accessfile or die "$accessfile : $!\n";
my @allows = ();
while (ACCESS) {
  push @allows, {Allow = "from $1" } if  /^Allow from (.+)/;
}
close ACCESS;

   ### This is the part that i'm not sure of
$Directory{'/home/mydirectory'} = {
 Order = 'deny,allow',
 Deny  = 'from all',
 @allows,
};

I get the following Error message when I start the server:
Perl: Invalid command 'HASH(0x268cec)', perhaps mis-spelled or defined
by
 a module not included in the server configuration

I am running Apache 1.3.12 mod_perl 1.21 on UNIX. Built with
EVERYTHING=1. btw, my other Perl Section'ed
configuration are working...

Unfortunately the docs only show examples of single Allow froms, which
doesn't tell me if I should put the "Allow from $ip" in a hash or an
array reference:

@allows = { Allow = "from $ip"} or Allow = ["from $ip1", from "$ip2",
...,"from $ipN"]



Thanks,

Carlos


-- 
Claiming that your operating system is the best in the world because
more people use it is like saying
McDonalds makes the best food in the world.



Problems with Perl sections.

2000-07-01 Thread Michael J Schout

I'm having some issues with Perl sections.  Basically what I have is a setup
like this:

httpd.conf:

Perl
   my %handlers = (
   '/foo' = { HANDLER = 'GKG::Foo', FILTER = 1 },
   '/bar/foo' = { HANDLER = 'GKG::FooBar' }
   );

   for my $i (keys %handlers) {
   my %conf = %{$handlers{$i}};
   $Location{$i} = {
   PerlHandler = $conf{HANDLER},
   SetHandler  = 'perl-script'
   };

   if (defined $conf{FILTER}) {
   push @{ $Location{$i}-{PerlSetVar} }, ['Filter', 'On'];
   }
   }
/Perl


The problem is that when this gets configured it does not seem to correctly
deal with the URL locations.  In my case, both /foo and /bar/foo  execute
GKG::Foo.  It seems to think that since location "/bar/foo" contains "/foo"
that it should use the handler "GKG::Foo" instead of handler "GKG::FooBar".

Also, standard static urls such as "/js/foo.js" end up getting caught by mod
perl and the output from "GET /js/foo.js" will be the content from the
perl-handler GKG::Foo, not the contents of the static file /js/foo.js!  

If I configure it without perl-sections like this:

Location /foo
SetHandler perl-script
Perlhandler GKG::Foo
/Location
  
Location /bar/foo
SetHandler perl-script
Perlhandler GKG::FooBar
/Location

Then it works correctly.  So there definately seems to either be a problem with
Perl sections, or the semantics of using %Location inside a Perl section does
not agree with the standard Location block.

Does anyone have any ideas what might be the problem here?  Is this a bug, or
am I just using this incorrectly?

Thanks for any ideas :).

I'm using mod_perl 1.24, perl 5.6.0 Linux 2.2.x

Mike




Re: Problems with Perl sections.

2000-07-01 Thread Michael J Schout

Ok I think I might have figured this one out.

If I treat the keys of %Location as regexps I sseem to get the desired results
:).

e.g.: '^/foo$', '^/bar/foo$'

Maybe this shold be documented in the guide better?

Mike
 




backticks in perl sections?

2000-05-30 Thread Kees Vonk 7249 24549

I have a question about perl sections, I have the need to 
build a httpd.conf file that can be run on more than one 
server, this means that I need to determine what the server 
name is (for the ServerName directive), I think I can do this 
by putting:

Perl
   $ServerName = `uname -n`;
/Perl

but is it wise to put backticks in a Perl section (as 
backticks cause a fork) or is there an all perl solution for 
this.


Kees




Re: backticks in perl sections?

2000-05-30 Thread Honza Pazdziora

On Tue, May 30, 2000 at 11:35:27AM +0100, Kees Vonk 7249 24549 wrote:
 I have a question about perl sections, I have the need to 
 build a httpd.conf file that can be run on more than one 
 server, this means that I need to determine what the server 
 name is (for the ServerName directive), I think I can do this 
 by putting:
 
 Perl
$ServerName = `uname -n`;
 /Perl
 
 but is it wise to put backticks in a Perl section (as 
 backticks cause a fork) or is there an all perl solution for 

Module Sys::Hostname tries to get the name by a syscall before
reverting to uname -n. You might want to give it a try.

-- 

 Honza Pazdziora | [EMAIL PROTECTED] | http://www.fi.muni.cz/~adelton/
   .project: Perl, DBI, Oracle, MySQL, auth. WWW servers, MTB, Spain.




Re: backticks in perl sections?

2000-05-30 Thread Stas Bekman

On Tue, 30 May 2000, Honza Pazdziora wrote:

 On Tue, May 30, 2000 at 11:35:27AM +0100, Kees Vonk 7249 24549 wrote:
  I have a question about perl sections, I have the need to 
  build a httpd.conf file that can be run on more than one 
  server, this means that I need to determine what the server 
  name is (for the ServerName directive), I think I can do this 
  by putting:
  
  Perl
 $ServerName = `uname -n`;
  /Perl
  
  but is it wise to put backticks in a Perl section (as 
  backticks cause a fork) or is there an all perl solution for 
 
 Module Sys::Hostname tries to get the name by a syscall before
 reverting to uname -n. You might want to give it a try.

Like Honza said, but there is no problem with forking at the startup, this
is not the fork during the request processing.


_
Stas Bekman  JAm_pH --   Just Another mod_perl Hacker
http://stason.org/   mod_perl Guide  http://perl.apache.org/guide 
mailto:[EMAIL PROTECTED]   http://perl.org http://stason.org/TULARC
http://singlesheaven.com http://perlmonth.com http://sourcegarden.org




RE: how do I use perl sections

2000-05-05 Thread Benedict Lofstedt

Eric Cholet writes:

  
  but you're not following my example quoted above.
  @ScriptAlias is a list of aliases. Each alias is a _reference_ to
  a two-element array.
  

I got the following to work after stopping/restarting the server:

Perl
my @cgi_users = qw(xx yy);

foreach (@cgi_users) {
push @ScriptAlias, [ "/cgi-$_/", "/users/$_/cgi-bin/" ] ;
};
/Perl

Thanks for the patience.

--- benedict



Perl sections and custom configuration directives

2000-05-05 Thread Matt Sergeant

I have someone on the AxKit list asking if there's a way to do
configuration outside of .htaccess files. I figure rather than writing
some new code to do this, Perl sections could be used.

Will this work with custom directives, so basically could I do:

Perl
@AxAddStyleMap = (
[ 'text/xsl' = 'Apache::AxKit::Language::XSLT' ],
...
);
/Perl

I don't see why not, and I haven't tested it, but I just thought I'd
double check here first.

-- 
Matt/

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org http://xml.sergeant.org




Re: Perl sections and custom configuration directives

2000-05-05 Thread Matt Sergeant

Answering myself: It works.

Damn this product (mod_perl) is cool!

On Fri, 5 May 2000, Matt Sergeant wrote:

 I have someone on the AxKit list asking if there's a way to do
 configuration outside of .htaccess files. I figure rather than writing
 some new code to do this, Perl sections could be used.
 
 Will this work with custom directives, so basically could I do:
 
 Perl
 @AxAddStyleMap = (
   [ 'text/xsl' = 'Apache::AxKit::Language::XSLT' ],
   ...
 );
 /Perl
 
 I don't see why not, and I haven't tested it, but I just thought I'd
 double check here first.
 
 

-- 
Matt/

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org http://xml.sergeant.org




Re: Perl sections and custom configuration directives

2000-05-05 Thread Stas Bekman

On Fri, 5 May 2000, Matt Sergeant wrote:

 Answering myself: It works.
 
 Damn this product (mod_perl) is cool!
 
 On Fri, 5 May 2000, Matt Sergeant wrote:
 
  I have someone on the AxKit list asking if there's a way to do
  configuration outside of .htaccess files. I figure rather than writing
  some new code to do this, Perl sections could be used.
  
  Will this work with custom directives, so basically could I do:
  
  Perl
  @AxAddStyleMap = (
  [ 'text/xsl' = 'Apache::AxKit::Language::XSLT' ],
  ...
  );
  /Perl

Even a cleaner solution, especially if you distribute some sample
configuration files, would be to write this Perl file and load it with
PerlModule

AxConfig.pm:

package Apache::ReadConfig;

@AxAddStyleMap = (
[ 'text/xsl' = 'Apache::AxKit::Language::XSLT' ],
...
);

1;

  
  I don't see why not, and I haven't tested it, but I just thought I'd
  double check here first.
  
  
 
 -- 
 Matt/
 
 Fastnet Software Ltd. High Performance Web Specialists
 Providing mod_perl, XML, Sybase and Oracle solutions
 Email for training and consultancy availability.
 http://sergeant.org http://xml.sergeant.org
 
 



__
Stas Bekman | JAm_pH--Just Another mod_perl Hacker
http://stason.org/  | mod_perl Guide  http://perl.apache.org/guide 
mailto:[EMAIL PROTECTED]  | http://perl.orghttp://stason.org/TULARC/
http://singlesheaven.com| http://perlmonth.com http://sourcegarden.org
--




Re: Perl sections and custom configuration directives

2000-05-05 Thread Matt Sergeant

On Fri, 5 May 2000, Stas Bekman wrote:

 On Fri, 5 May 2000, Matt Sergeant wrote:
 
  Answering myself: It works.
  
  Damn this product (mod_perl) is cool!
  
  On Fri, 5 May 2000, Matt Sergeant wrote:
  
   I have someone on the AxKit list asking if there's a way to do
   configuration outside of .htaccess files. I figure rather than writing
   some new code to do this, Perl sections could be used.
   
   Will this work with custom directives, so basically could I do:
   
   Perl
   @AxAddStyleMap = (
 [ 'text/xsl' = 'Apache::AxKit::Language::XSLT' ],
 ...
   );
   /Perl
 
 Even a cleaner solution, especially if you distribute some sample
 configuration files, would be to write this Perl file and load it with
 PerlModule
 
 AxConfig.pm:
 
 package Apache::ReadConfig;
 
 @AxAddStyleMap = (
 [ 'text/xsl' = 'Apache::AxKit::Language::XSLT' ],
 ...
 );
 
 1;

Actually the idea comes from setting up the style map based on an external
XML site map, which would do things similar to apache's Files and
Location directives, and then put them into the appropriate sections in
Apache::ReadConfig. It's not something I'm going to ship with the product
just now though - but someone wants the ability to do so.

-- 
Matt/

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org http://xml.sergeant.org




Re: Perl sections and custom configuration directives

2000-05-05 Thread brian moseley

On Fri, 5 May 2000, Matt Sergeant wrote:

 Actually the idea comes from setting up the style map
 based on an external XML site map, which would do things
 similar to apache's Files and Location directives,
 and then put them into the appropriate sections in
 Apache::ReadConfig. It's not something I'm going to ship
 with the product just now though - but someone wants the
 ability to do so.

hi, that's me :)

actually matt, what i was shooting for was exposure to
axkit's internal configuration data structures. i don't want
to have to set up stuff in the $Apache::ReadConfig namespace
and then have all the apache gears crank back around to your
code. i'd rather have a configuration interface directly
into your code.

this way i can reconfigure axkit at runtime. using apache
config i can't do that.




Re: Perl sections and custom configuration directives

2000-05-05 Thread Matt Sergeant

On Fri, 5 May 2000, brian moseley wrote:

 On Fri, 5 May 2000, Matt Sergeant wrote:
 
  Actually the idea comes from setting up the style map
  based on an external XML site map, which would do things
  similar to apache's Files and Location directives,
  and then put them into the appropriate sections in
  Apache::ReadConfig. It's not something I'm going to ship
  with the product just now though - but someone wants the
  ability to do so.
 
 hi, that's me :)
 
 actually matt, what i was shooting for was exposure to
 axkit's internal configuration data structures. i don't want
 to have to set up stuff in the $Apache::ReadConfig namespace
 and then have all the apache gears crank back around to your
 code. i'd rather have a configuration interface directly
 into your code.
 
 this way i can reconfigure axkit at runtime. using apache
 config i can't do that.

Hmm... OK maybe a rethink is in order.

Perhaps something like this:

AxConfigReader MyModule

And AxKit defaults to its internal module which reads the Ax*
configuration directives directly? You could even inherit from the
internal config reader for options you don't want to override.

Sound OK?

-- 
Matt/

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org http://xml.sergeant.org




Re: Perl sections and custom configuration directives

2000-05-05 Thread brian moseley

On Fri, 5 May 2000, Matt Sergeant wrote:

 Hmm... OK maybe a rethink is in order.
 
 Perhaps something like this:
 
 AxConfigReader MyModule
 
 And AxKit defaults to its internal module which reads the Ax*
 configuration directives directly? You could even inherit from the
 internal config reader for options you don't want to override.
 
 Sound OK?

i wasn't thinking of using a configuration directive for it,
i was going to use PerlModule or PerlRequire. as long as
either approach will work equivalently, it sounds like a
good plan.





RE: how do I use perl sections

2000-05-04 Thread Benedict Lofstedt

Eric,

  push @ScriptAlias, [ "/cgi-$_", "/users/$_/cgi-bin" ];
  
   Where can I find better info than given in
   http://perl.apache.org/src/mod_perl.html#PERL_SECTIONS ?
  
  http://www.modperl.com/book/chapters/ch8.html#Configuring_Apache_with_Perl
  
  See the paragraph: "Directive is Repeated Multiple Times"
  

Thank you for a quick reply and a good reference.

However, it seems that I have found a problem.  Even the simplest construct:

Perl
push @ScriptAlias, "/cgi-benedict/", "/users/benedict/cgi-bin/"  ;
/Perl

doesn't work on my solaris2.7 box - but it works on my Solaris2.6 and my
Irix 6.5 boxes. 

Has anyone else experienced something similar?

--- benedict




RE: how do I use perl sections

2000-05-04 Thread Eric Cholet

 -Message d'origine-
 De:   Benedict Lofstedt [SMTP:[EMAIL PROTECTED]]
 Date: jeudi 4 mai 2000 15:38
 À:Eric Cholet
 Cc:   [EMAIL PROTECTED]
 Objet:RE: how do I use perl sections
 
 Eric,
 
   push @ScriptAlias, [ "/cgi-$_", "/users/$_/cgi-bin" ];
   
Where can I find better info than given in
http://perl.apache.org/src/mod_perl.html#PERL_SECTIONS ?
   
   http://www.modperl.com/book/chapters/ch8.html#Configuring_Apache_with_Perl
   
   See the paragraph: "Directive is Repeated Multiple Times"
   
 
 Thank you for a quick reply and a good reference.
 
 However, it seems that I have found a problem.  Even the simplest construct:
 
 Perl
 push @ScriptAlias, "/cgi-benedict/", "/users/benedict/cgi-bin/"  ;
 /Perl

but you're not following my example quoted above.
@ScriptAlias is a list of aliases. Each alias is a _reference_ to
a two-element array.

--
Eric





how do I use perl sections

2000-05-03 Thread Benedict Lofstedt

I would like to make a list of ScriptAliases like this

ScriptAlias "/cgi-xx" "/users/xx/cgi-bin/"
ScriptAlias "/cgi-yy" "/users/yy/cgi-bin/"

and did this:

Perl
my $cgi_users = qw(xx yy);
for ($cgi_users) {
  push @ScriptAlias, "/cgi-$_", "/users/$_/cgi-bin";
}
/Perl

but it did not work.

What is wrong with this Perl section?

Where can I find better info than given in
http://perl.apache.org/src/mod_perl.html#PERL_SECTIONS ?

I have PERL_SECTIONS=1 in my mod_perl build, and the configuration is read
without any errors.

--- benedict

-- 
Benedict Lofstedt [EMAIL PROTECTED]
University of Aarhus, Department of Computer Science  Fax:   + 45 8942 3255
Building 540, Ny Munkegade, DK-8000 Aarhus C, Denmark.Phone: + 45 8942 3222



RE: how do I use perl sections

2000-05-03 Thread Eric Cholet

 I would like to make a list of ScriptAliases like this
 
 ScriptAlias "/cgi-xx" "/users/xx/cgi-bin/"
 ScriptAlias "/cgi-yy" "/users/yy/cgi-bin/"
 
 and did this:
 
 Perl
 my $cgi_users = qw(xx yy);
 for ($cgi_users) {
   push @ScriptAlias, "/cgi-$_", "/users/$_/cgi-bin";
 }
 /Perl
 
 but it did not work.
 
 What is wrong with this Perl section?

push @ScriptAlias, [ "/cgi-$_", "/users/$_/cgi-bin" ];

 Where can I find better info than given in
 http://perl.apache.org/src/mod_perl.html#PERL_SECTIONS ?

http://www.modperl.com/book/chapters/ch8.html#Configuring_Apache_with_Perl

See the paragraph: "Directive is Repeated Multiple Times"

--
Eric




Two problems with Perl sections...

2000-05-03 Thread Robert S. Thau

Hi.  I'm having two problems with Perl sections --- one resulting in
a server coredump, and the other just odd.  My test configuration is
Apache/1.3.12 and mod_perl_1.23 built from distributed sources with:

  perl Makefile.PL DO_HTTPD=1 USE_APACI=1 EVERYTHING=1 PERL_TRACE=1 
APACHE_PREFIX=/opt/software/mpsandbox APACHE_HEADER_INSTALL=0

conf/httpd.conf is identical to httpd.conf_default except for a
different Port, and the following at the end:

  Perl
  do 'conf/conf.pl';
  /Perl

If conf/conf.pl contains:

  @Listen=(5050,5051);
  #$ServerAdmin='[EMAIL PROTECTED]';
  1;

then everything works as expected.  My problems are:

1) If the ServerAdmin line is uncommented, then the server dumps
   core on startup.  Backtrace included below.

2) If I comment the ServerAdmin line back out, but change the 'do'
   in httpd.conf to a 'require', the server starts, but is not listening
   on ports 5050 and 5051 when it does.  What makes this case peculiar
   is that with MOD_PERL_TRACE=ds, the output produced by the PERL_TRACE
   facility is the same in both cases; it claims to find and execute the
   Limit commands either way.

   This may have something to do with the 'require' not reading the file
   a second time... but if @INC is preserved, I would have expected the
   vars in the Apache::ReadConfig symbol table to be preserved as well.

Any ideas what's up?

BTW, on another topic, what's up with support for Perl sections in
Apache/2.0?  Some of the discussion on new-httpd seems to indicate that
it's not quite there yet...

rst

PS:  Here's the backtrace from the coredump:

#0  0x40151fea in _IO_vfprintf (s=0xbfff8e98, 
format=0x811e1c9 "perl_section: /%s\n", ap=0xbfffb60c) at vfprintf.c:1248
#1  0x40154ed8 in buffered_vfprintf (s=0x401f4260, 
format=0x811e1c9 "perl_section: /%s\n", args=0xbfffb608)
at vfprintf.c:1747
#2  0x40150856 in _IO_vfprintf (s=0x401f4260, 
format=0x811e1c9 "perl_section: /%s\n", ap=0xbfffb608) at vfprintf.c:1018
#3  0x401586f7 in fprintf (stream=0x401f4260, 
format=0x811e1c9 "perl_section: /%s\n") at fprintf.c:32
#4  0x807f4ec in perl_filesection ()
#5  0x807f7db in perl_handle_command_hv ()
#6  0x8080149 in perl_section ()
#7  0x80956e9 in ap_clear_module_list ()
#8  0x8096163 in ap_handle_command ()
#9  0x80961f7 in ap_srm_command_loop ()
#10 0x8096600 in ap_process_resource_config ()
#11 0x8096ec2 in ap_read_config ()
#12 0x80a0ed9 in main ()
#13 0x40123cb3 in __libc_start_main (main=0x80a0c4c main, argc=1, 
argv=0xb894, init=0x8060068 _init, fini=0x8116ffc _fini, 
rtld_fini=0x4000a350 _dl_fini, stack_end=0xb88c)
at ../sysdeps/generic/libc-start.c:78



Configuring Apache with PERL sections - how to do custom access log?

2000-05-03 Thread James Olsen

Hello everyone,

I have quite a few virtual hosts on my Apache server. I'm trying to 
implement their configuration in PERL sections instead of  the current 
method bunch of VirtualHost directives.

I use the "combined" transfer log, previously defined like this:
TransferLog /path/to/logcombined

The new method I attempted is like this:
   $VirtualHost{servername} = {
 TransferLog  = "logs/$servername-access_log combined",
 
 }

However, when I attempt to check the config or start the server, I get the 
following error:

Perl: TransferLog takes one argument, the filename of the access log

There isn't a list of variables/structures that I found describing all the 
nuances of PERL sections.  Does anyone have any suggestions how I can 
achieve this?

--James




Re: Perl Sections and Virtual Host

2000-04-20 Thread Doug MacEachern

i've only skimmed this thread, but haven't seen any mention of chapter 8
online at http://modperl.com/ which covers Perl sections in detail.




Re: Perl Sections and Virtual Host

2000-04-19 Thread Pierre-Yves BONNETAIN


  my $realname = 'http://www.main.org';
  my %vnames = ( 'sec.ondary.com' = 'second', 'third.dom.com' = 'third' );
  ^^^
  foreach (keys %vnames) {
 ^^^
  $VirtualHost{'192.168.1.2:80'} = {
  ServerName = $_,
  RedirectPermanent = ( ['/', "$realname/$vname{$_}/index.phtml"] )
   ^^

 Maybe this is just in your example, but you might have cut-and-pasted from
 yor config, so I'll mention it: In your RedirectPermanent, you are referencing
 %vname, not %vnames. Without strict turned on in your Perl section, Perl 
 won't tell you.

   Yep, I caught this one a few minutes ago (but if I had read my mail earlier,
your message would have saved half of my day. Well, there are times like 
that...).

   I'm getting somewhat closer, I think it's now just a matter of understanding
more precisely 'what' should be used as the RedirectPermanent value. This
work just fine now :

Perl
my $realname = 'real.domain.com';

my %vnames = ( 'prim.ary.com' = 'first', 'sec.ondary.com' = 'second' );

$VirtualHost{'192.168.1.2:80'} = [ { ServerName = $realname } ];

foreach (keys %vnames) {
my $vhref = {
ServerName = $_,
RedirectPermanent = "/ http://$realname/$vnames{$_}/"
};

push @{$VirtualHost{'192.168.1.2:80'}}, $vhref;
}
/Perl

   Whenever I ask for http://prim.ary.com, I get transparently redirected to
http://real.domain.com/first. Cute. Almost there.

   But I have other URLs I want to remap. Say, prim.ary.com/europe should be
mapped to real.domain.com/europe. With the above setup, I am redirected to
real.domain.com/first/europe. So I need now to have _several_ RedirectPermanent
(or anything that could save my whole day -- well, night, it's 23 pm here).
   I have tried a helluva lot of syntaxes, I'm ashamed to say, to no avail. The
right one just escapes me.
   Any hints ?
   Tia,
-- Pierre-Yves BONNETAIN
   CTO -- http://www.rouge-blanc.com  --  Fastest wines in Europe.




Perl Sections and Virtual Host

2000-04-18 Thread Pierre-Yves BONNETAIN

   Hello modperlers,

   I'm currently banging my head on the walls trying to use Perl sections, in
the httpd.conf file, to configure virtual hosts. The idea is to redirect lots
of 'secondary' domains to URLs on our 'main' website.
   Let's say the main website is www.main.org, and secondary domain are
sec.ondary.com and third.dom.com. With a regular Virtual host config, no
sweat (well, it seems so; maybe an Apache expert will tell me I forgot
something big and important :-)

NameVirtualHost 192.168.1.2:80

VirtualHost 192.168.1.2:80
ServerName  sec.ondary.com
RedirectPermanent / http://www.main.org/second/index.phtml
/VirtualHost

VirtualHost 192.168.1.2:80
ServerName  third.dom.com
RedirectPermanent / http://www.main.org/third/index.phtml
/VirtualHost

   Since we have several secondary domains, and lots of URLs to remap in
different ways depending on the secondary domain, I thought going through a
Perl section would be cute. So, dumbly, I wrote this to replace the 
VirtualHost sections above (the NameVirtualHost does not change) :

Perl
my $realname = 'http://www.main.org';
my %vnames = ( 'sec.ondary.com' = 'second', 'third.dom.com' = 'third' );
foreach (keys %vnames) {
$VirtualHost{'192.168.1.2:80'} = {
ServerName = $_,
RedirectPermanent = ( ['/', "$realname/$vname{$_}/index.phtml"] )
}
}
/Perl

   No way. No errors during the server startup, but also no redirection
whatsoever. Where am I wrong, or what did I forget ?
   I'm using
  Embedded Perl version 5.00503 for Apache/1.3.9 (Unix) mod_perl/1.21
  mod_ssl/2.4.9 OpenSSL/0.9.4
   Tia,
-- Pierre-Yves BONNETAIN
   CTO
   http://www.rouge-blanc.com -- Fastest wines in Europe




No pid while processing Perl sections?

1999-12-07 Thread Matt Sergeant

I'm stumped. I've been trying out Sybase's ASA on Linux along with
DBD::ASAny. Works fine from the command line and from within handlers, but
when I connect from a Perl section it says (paraphrased - this is at a
clients):

Disconnecting shared memory client: no process id

Or something like that. I've printed out $$ and that's valid, as are UID,
EUID, GID, EGID, etc. (albeit all different after the fork - obviously).
Could there be something wierd going on here with mod_perl in the Perl
section?

-- 
Matt/

Details: FastNet Software Ltd - XML, Perl, Databases.
Tagline: High Performance Web Solutions
Web Sites: http://come.to/fastnet http://sergeant.org
Available for Consultancy, Contracts and Training.



Re: Perl not allowed here? (Perl sections)

1999-11-25 Thread Ken Williams

Problem solved.  

Jay J pointed out to me in private email that this had probably been
fixed in the latest development snapshot, and indeed it has.

See http://www.davin.ottawa.on.ca/archive/modperl/1999-07/msg01080.phtml


[EMAIL PROTECTED] (Ken Williams) wrote:
Hi,

I'm getting the error "Perl not allowed here" when I try to use Perl
sections in an .htaccess file under mod_perl 1.21.  The same setup
works fine under mod_perl 1.18 (my frontend server).

The .htaccess is simple, it's just got a Perl section that's about 10
lines long, not nested inside anything else.

I'm positive that the PerlSections hook is enabled, because
Apache::Status says so, and because if I misspell the directive I get a
different error ("Invalid command 'Peerl', perhaps mis-spelled or
defined by a module not included in the server configuration").


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




Perl not allowed here? (Perl sections)

1999-11-24 Thread Ken Williams

Hi,

I'm getting the error "Perl not allowed here" when I try to use Perl sections
in an .htaccess file under mod_perl 1.21.  The same setup works fine under
mod_perl 1.18 (my frontend server).  

The .htaccess is simple, it's just got a Perl section that's about 10 lines
long, not nested inside anything else.

I'm positive that the PerlSections hook is enabled, because Apache::Status says
so, and because if I misspell the directive I get a different error ("Invalid
command 'Peerl', perhaps mis-spelled or defined by a module not included in
the server configuration").

Any clues?


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