Re: Modifying @INC via startup.pl

2002-05-18 Thread PinkFreud

Perhaps this might work:

BEGIN {
  use lib qw(/dir/foo);
}

On Sat, May 18, 2002 at 07:50:01PM -0500, Gregory Matthews babbled thus:
 X-Mailer: QUALCOMM Windows Eudora Version 5.1
 Date: Sat, 18 May 2002 19:50:01 -0500
 To: Jaberwocky [EMAIL PROTECTED]
 From: Gregory Matthews [EMAIL PROTECTED]
 Subject: Re: Modifying @INC via startup.pl
 Cc: [EMAIL PROTECTED]
 
 Tried that...doesn't work either.
 
 @INC still cannot find my config.pl file.  If I add the use lib statement 
 to my script, all is o.k..  If I try to add it to my startup.pl and call it 
 at startup time, I get the error from @INC.
 
 
 
 At 06:16 PM 5/18/2002 -0400, you wrote:
 I did this:
 
 use lib qw(path to files);
 
 That adds the path to @INC. Someone correct me if that's the wrong way to 
 do
 things
 
 - Original Message -
 From: Gregory Matthews [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Saturday, May 18, 2002 6:12 PM
 Subject: Modifying @INC via startup.pl
 
 
  I am trying to:
 
  use lib qw(/dir/foo);
 
  in my startup.pl file but @INC is NOT showing the path. I keep getting
  Can't locate config.pl in @INC errors after restarting the server and
  calling the script.
 
  My prog reads:
 
  require qq(config.pl);
 
  I am not sure what is going on. @INC shows:
 
  (@INC contains: /usr/libdata/perl/5.00503/mach /usr/libdata/perl/5.00503
  /usr/local/lib/perl5/site_perl/5.005/i386-freebsd
  /usr/local/lib/perl5/site_perl/5.005 . /usr/local/www/
  /usr/local/www/lib/perl) at (eval 265) line 22.
 
  Why is the path to config.pl not showing up?  My defaults.conf reads:
 
  # mod_perl setup
  Alias /perl /usr/local/www/vhosts/host.com/perl
  PerlRequire /usr/local/www/vhosts/host.com/perl/libs/startup.pl
  PerlSetEnv PERLDB_OPTS NonStop=1 LineInfo=/tmp/db.out AutoTrace=1
 frame=2
  PerlModule Apache::DB
  PerlWarn On
  PerlTaintCheck On
  Directory /usr/local/www/vhosts/host.com/perl
 PerlFixupHandler  +Apache::DB
 SetHandler perl-script
 PerlHandler   +Apache::Registry
 Options   +ExecCGI
 allow from all
 PerlSendHeader Off
  /Directory
  # end mod_perl setup
 
  Thanks everyone.  This list is a lifesaver!
 
  Gregory
 
 
 
 
 
 

-- 

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 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 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 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.