cvs commit: modperl-2.0/t/response/TestModperl dir_config.pm

2002-05-19 Thread stas

stas02/05/19 00:53:27

  Modified:t/response/TestModperl dir_config.pm
  Log:
  test that sub-section overrides parent section for the same key
  
  Revision  ChangesPath
  1.4   +9 -2  modperl-2.0/t/response/TestModperl/dir_config.pm
  
  Index: dir_config.pm
  ===
  RCS file: /home/cvs/modperl-2.0/t/response/TestModperl/dir_config.pm,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- dir_config.pm 11 Apr 2002 11:08:44 -  1.3
  +++ dir_config.pm 19 May 2002 07:53:27 -  1.4
   -16,7 +16,7 
   sub handler {
   my $r = shift;
   
  -plan $r, tests = 12;
  +plan $r, tests = 13;
   
   #Apache::RequestRec::dir_config tests
   
   -38,6 +38,13 
'testing PerlAddVar ITERATE2');
   }
   
  +# sub-section overrides parent section for the same key
  +{
  +my $key = 'TestModperl__server_rec_Key_set_in_Base';
  +ok t_cmp('SubSecValue', $r-dir_config-get($key),
  + sub-section overrides parent section for the same key);
  +}
  +
   {
   my $key = make_key('0');
   
   -159,4 +166,4 
   PerlAddVar TestModperl__request_rec_Key1 2_AddValue
   PerlAddVar TestModperl__request_rec_Key1 3_AddValue 4_AddValue
   
  -PerlSetVar TestModperl__server_rec_Key_set_in_Base WhatEver
  +PerlSetVar TestModperl__server_rec_Key_set_in_Base SubSecValue
  
  
  



cvs commit: modperl-2.0 STATUS

2002-05-19 Thread stas

stas02/05/19 02:28:06

  Added:   .STATUS
  Log:
  start the STATUS file
  
  Revision  ChangesPath
  1.1  modperl-2.0/STATUS
  
  Index: STATUS
  ===
  mod_perl 2.0 STATUS:   -*-text-*-
 Last modified at [$Date: 2002/05/19 09:28:06 $]
  
  Release:
  
  
 1.99_02-dev: In development.
 1.99_01: Released April 06, 2002
  
  Release Showstoppers:
  -
  
   * 
 Report: 
 Status: 
  
  
  
  Available Patches:
  --
  
  
  Needs Patch or Further Investigation:
  -
  
  
  Open Issues or Core Enhancements:
  -
  
  
  Documentation:
  --
  
  
  Patches unlikely to be applied:
  ---
  
   * 
 Report: 
 Status: 
  
  
  
  



cvs commit: modperl-2.0/t/response/TestAPI module.pm

2002-05-19 Thread dougm

dougm   02/05/19 12:10:45

  Modified:t/response/TestAPI module.pm
  Log:
  fix broken test #2
  
  Revision  ChangesPath
  1.7   +2 -2  modperl-2.0/t/response/TestAPI/module.pm
  
  Index: module.pm
  ===
  RCS file: /home/cvs/modperl-2.0/t/response/TestAPI/module.pm,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- module.pm 13 May 2002 18:19:28 -  1.6
  +++ module.pm 19 May 2002 19:10:45 -  1.7
   -24,8 +24,8 
   
   ok $top_module;
   
  -ok t_cmp($cfg-{httpd_info}-{MODULE_MAGIC_NUMBER},
  - $top_module-version . ':0',
  +ok t_cmp($cfg-{httpd_info}-{MODULE_MAGIC_NUMBER_MAJOR},
  + $top_module-version,
q{$top_module-version});
   
   ok t_cmp(scalar keys %{ $cfg-{modules} },
  
  
  



cvs commit: modperl-2.0/xs/Apache/RequestRec - New directory

2002-05-19 Thread dougm

dougm   02/05/19 13:08:46

  modperl-2.0/xs/Apache/RequestRec - New directory



cvs commit: modperl-2.0/xs/Apache/RequestRec Apache__RequestRec.h

2002-05-19 Thread dougm

dougm   02/05/19 13:09:27

  Added:   xs/Apache/RequestRec Apache__RequestRec.h
  Log:
  wrapper for $r-content_type
  
  Revision  ChangesPath
  1.1  modperl-2.0/xs/Apache/RequestRec/Apache__RequestRec.h
  
  Index: Apache__RequestRec.h
  ===
  static MP_INLINE
  const char *mpxs_Apache__RequestRec_content_type(pTHX_ request_rec *r,
   SV *type)
  {
  const char *retval = r-content_type;
  
  if (type) {
  STRLEN len;
  const char *val = SvPV(type, len);
  ap_set_content_type(r, apr_pmemdup(r-pool, val, len));
  }
  
  return retval;
  }
  
  
  



cvs commit: modperl-2.0/xs/tables/current/ModPerl FunctionTable.pm

2002-05-19 Thread dougm

dougm   02/05/19 13:11:56

  Modified:xs/maps  apache_functions.map apache_structures.map
modperl_functions.map
   xs/tables/current/ModPerl FunctionTable.pm
  Log:
  wrap $r-content_type(foo/bar) so ap_set_content_type is called underneath
  
  Revision  ChangesPath
  1.51  +1 -1  modperl-2.0/xs/maps/apache_functions.map
  
  Index: apache_functions.map
  ===
  RCS file: /home/cvs/modperl-2.0/xs/maps/apache_functions.map,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- apache_functions.map  19 May 2002 01:05:30 -  1.50
  +++ apache_functions.map  19 May 2002 20:11:55 -  1.51
   -49,7 +49,7 
   ap_rgetline_core
   ?ap_get_request_note
   ?ap_register_request_note
  - ap_set_content_type
  +~ap_set_content_type
   
   #MODULE=Apache::RequestConfig
ap_document_root
  
  
  
  1.15  +1 -1  modperl-2.0/xs/maps/apache_structures.map
  
  Index: apache_structures.map
  ===
  RCS file: /home/cvs/modperl-2.0/xs/maps/apache_structures.map,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- apache_structures.map 19 May 2002 01:05:30 -  1.14
  +++ apache_structures.map 19 May 2002 20:11:55 -  1.15
   -40,7 +40,7 
  err_headers_out
  subprocess_env
  notes
  -   content_type
  +~  content_type
  handler
  content_encoding
  content_languages
  
  
  
  1.37  +3 -0  modperl-2.0/xs/maps/modperl_functions.map
  
  Index: modperl_functions.map
  ===
  RCS file: /home/cvs/modperl-2.0/xs/maps/modperl_functions.map,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- modperl_functions.map 10 May 2002 17:48:27 -  1.36
  +++ modperl_functions.map 19 May 2002 20:11:55 -  1.37
   -8,6 +8,9 
mpxs_ModPerl__Global_special_list_call
mpxs_ModPerl__Global_special_list_clear
   
  +MODULE=Apache::RequestRec   PACKAGE=Apache::RequestRec
  + mpxs_Apache__RequestRec_content_type | | r, type=Nullsv
  +
   MODULE=Apache::RequestUtil   PACKAGE=guess
mpxs_Apache__RequestRec_push_handlers
mpxs_Apache__RequestRec_set_handlers
  
  
  
  1.64  +19 -1 modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm
  
  Index: FunctionTable.pm
  ===
  RCS file: /home/cvs/modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm,v
  retrieving revision 1.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- FunctionTable.pm  18 May 2002 23:56:54 -  1.63
  +++ FunctionTable.pm  19 May 2002 20:11:55 -  1.64
   -2,7 +2,7 
   
   # !!
   # ! WARNING: generated by ModPerl::ParseSource/0.01
  -# !  Sat May 18 16:46:32 2002
  +# !  Sun May 19 12:59:55 2002
   # !  do NOT edit, any changes will be lost !
   # !!
   
   -4366,6 +4366,24 
 {
   'type' = 'request_rec *',
   'name' = 'r'
  +  }
  +]
  +  },
  +  {
  +'return_type' = 'const char *',
  +'name' = 'mpxs_Apache__RequestRec_content_type',
  +'args' = [
  +  {
  +'type' = 'PerlInterpreter *',
  +'name' = 'my_perl'
  +  },
  +  {
  +'type' = 'request_rec *',
  +'name' = 'r'
  +  },
  +  {
  +'type' = 'SV *',
  +'name' = 'type'
 }
   ]
 },
  
  
  



cvs commit: modperl-2.0/xs/Apache/Response Apache__Response.h

2002-05-19 Thread dougm

dougm   02/05/19 16:01:12

  Modified:xs/Apache/Response Apache__Response.h
  Log:
  use ap_set_content_type rather than directly setting r-content_type
  in $r-send_http_header
  
  Revision  ChangesPath
  1.7   +1 -1  modperl-2.0/xs/Apache/Response/Apache__Response.h
  
  Index: Apache__Response.h
  ===
  RCS file: /home/cvs/modperl-2.0/xs/Apache/Response/Apache__Response.h,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Apache__Response.h21 Jan 2002 08:27:30 -  1.6
  +++ Apache__Response.h19 May 2002 23:01:12 -  1.7
   -20,7 +20,7 
   MP_dRCFG;
   
   if (type) {
  -r-content_type = apr_pstrdup(r-pool, type);
  +ap_set_content_type(r, apr_pstrdup(r-pool, type));
   }
   
   rcfg-wbucket-header_parse = 0; /* turn off PerlOptions +ParseHeaders */
  
  
  



cvs commit: modperl-2.0/xs/maps apache_functions.map apr_functions.map

2002-05-19 Thread dougm

dougm   02/05/19 16:59:52

  Modified:xs/maps  apache_functions.map apr_functions.map
  Log:
  misc api mapping changes:
  - swap internal_fast_redirect, ap_die args
  - alias sub_req_lookup_dirent to lookup_dirent, reorder/default args
  - disable ap_run_child_init, apr_gethostname, apr_base64_decode_len
  
  Revision  ChangesPath
  1.52  +4 -4  modperl-2.0/xs/maps/apache_functions.map
  
  Index: apache_functions.map
  ===
  RCS file: /home/cvs/modperl-2.0/xs/maps/apache_functions.map,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- apache_functions.map  19 May 2002 20:11:55 -  1.51
  +++ apache_functions.map  19 May 2002 23:59:52 -  1.52
   -81,8 +81,8 
   -ap_finalize_sub_req_protocol
ap_internal_redirect | | r, new_uri
ap_internal_redirect_handler | | r, new_uri
  - ap_internal_fast_redirect
  - ap_sub_req_lookup_dirent
  + ap_internal_fast_redirect| | r, sub_req
  + ap_sub_req_lookup_dirent | | r, finfo, subtype=AP_SUBREQ_NO_ARGS, 
next_filter=NULL | lookup_dirent
   
   subrequest_rec *:ap_sub_req_lookup_file | | \
r, new_file, next_filter=r-output_filters-next | lookup_file
   -436,7 +436,7 
   ap_run_open_logs
   ap_run_post_config
   ap_run_insert_filter
  - ap_run_child_init
  +ap_run_child_init
   ?ap_run_default_port
   ?ap_run_http_method
   ap_run_create_connection
   -460,7 +460,7 
   ap_run_pre_mpm
   !ap_run_quick_handler
ap_invoke_handler
  - ap_die
  + ap_die | | r, type
   
   !MODULE=Apache::MD5
ap_md5
  
  
  
  1.40  +2 -2  modperl-2.0/xs/maps/apr_functions.map
  
  Index: apr_functions.map
  ===
  RCS file: /home/cvs/modperl-2.0/xs/maps/apr_functions.map,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- apr_functions.map 19 May 2002 01:05:30 -  1.39
  +++ apr_functions.map 19 May 2002 23:59:52 -  1.40
   -489,7 +489,7 
apr_current_userid
   
   MODULE=APR::NetLib
  - apr_gethostname
  +-apr_gethostname
apr_getnameinfo
   -apr_getservbyname
apr_parse_addr_port
   -551,7 +551,7 
apr_base64_decode | MPXS_ | coded_src
apr_base64_encode | MPXS_ | plain_src
apr_base64_encode_len
  - apr_base64_decode_len
  +-apr_base64_decode_len
   -apr_base64_encode_binary
   -apr_base64_decode_binary
   
  
  
  



Re: Reloading Library Files

2002-05-19 Thread Stas Bekman

Ted Prah wrote:
 Hi,
 
 I am new to mod_perl and am having problems seeing the
 changes made to library files.  Must I restart the server every
 time I change a library file in order to see my changes?  My
 test code and environment is below.

Hmm, I haven't used StatINC for a long time, any luck with Apache::Reload?
http://perl.apache.org/guide/porting.html#Using_Apache_Reload

__
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: Modifying @INC via startup.pl

2002-05-19 Thread Per Einar Ellefsen

At 02:50 19.05.2002, Gregory Matthews wrote:
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.

Are you sure you are loading your startup.pl file before your module?
Are you sure it's getting loaded at all?
Try adding a debug statement in your startup.pl:

print STDERR 'Loading startup.pl  @INC = ', join :, @INC;

after your use lib part.

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
 
 
 
 



-- 
Per Einar Ellefsen
[EMAIL PROTECTED]





Scripts and passwd

2002-05-19 Thread john . buwa


 I have written scripts to add a user to the passwd and shadow files as well
as sendmail user files. When I run this script from the command line for
testing all runs and completes fine. But when I run the script from apache
via the web interface I designed it for, I get file permission errors on the
additions to passwd and the rest of the scripts. How can I get the script to
access those files?

Thanks!




Re: Scripts and passwd

2002-05-19 Thread Per Einar Ellefsen

At 10:22 19.05.2002, [EMAIL PROTECTED] wrote:

  I have written scripts to add a user to the passwd and shadow files as well
as sendmail user files. When I run this script from the command line for
testing all runs and completes fine. But when I run the script from apache
via the web interface I designed it for, I get file permission errors on the
additions to passwd and the rest of the scripts. How can I get the script to
access those files?

You're doing something pretty risky there. the passwd/shadow files are only 
writable by root. So I suppose that when running them from the command line 
you run them as root. Apache doesn't run as root (its children which serve 
the requests atleast), so mod_perl (I suppose you *are* using mod_perl? If 
not, this is more appropriate for another newsgroup) won't either.

If you can run your script as CGI, you could use suEXEC. But really, really 
consider the security implications of what you're doing there before 
allowing users to trash your machine very fast...


-- 
Per Einar Ellefsen
[EMAIL PROTECTED]





Re: Scripts and passwd

2002-05-19 Thread john . buwa


Hello

Thanks for the reply. Yes this server is running mod perl :)

As for risky. Well the whole point of the script system is to add a pop mail
box for a user. But in order to do this i have to do the following:

add user to the passwd/shadow file
add user to the virtusertable and genericstable
recompile the sendmail config files

Then and only then is the new mailbox ready for use. This is the only way I
can think of to accomplish this via an automated web proccess. I dont even
know if you can do it any other way with out touching the passwd/shadow
files?

Thanks! John.

 You're doing something pretty risky there. the passwd/shadow files are
only
 writable by root. So I suppose that when running them from the command
line
 you run them as root. Apache doesn't run as root (its children which serve
 the requests atleast), so mod_perl (I suppose you *are* using mod_perl? If
 not, this is more appropriate for another newsgroup) won't either.

 If you can run your script as CGI, you could use suEXEC. But really,
really
 consider the security implications of what you're doing there before
 allowing users to trash your machine very fast...


 --
 Per Einar Ellefsen
 [EMAIL PROTECTED]






Re: Scripts and passwd

2002-05-19 Thread Richard Clarke

You could migrate to a database based mail authentication solution.
Postfix+cyrus springs to mind.

Ric

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, May 19, 2002 9:56 AM
Subject: Re: Scripts and passwd



 Hello

 Thanks for the reply. Yes this server is running mod perl :)

 As for risky. Well the whole point of the script system is to add a pop
mail
 box for a user. But in order to do this i have to do the following:

 add user to the passwd/shadow file
 add user to the virtusertable and genericstable
 recompile the sendmail config files

 Then and only then is the new mailbox ready for use. This is the only way
I
 can think of to accomplish this via an automated web proccess. I dont even
 know if you can do it any other way with out touching the passwd/shadow
 files?

 Thanks! John.

  You're doing something pretty risky there. the passwd/shadow files are
 only
  writable by root. So I suppose that when running them from the command
 line
  you run them as root. Apache doesn't run as root (its children which
serve
  the requests atleast), so mod_perl (I suppose you *are* using mod_perl?
If
  not, this is more appropriate for another newsgroup) won't either.
 
  If you can run your script as CGI, you could use suEXEC. But really,
 really
  consider the security implications of what you're doing there before
  allowing users to trash your machine very fast...
 
 
  --
  Per Einar Ellefsen
  [EMAIL PROTECTED]
 
 





Authorisation Techniques

2002-05-19 Thread Jim Morrison [Mailinglists]

Guys,

This is probably a very common question, so I will keep it breif.. perhaps
someone could point me to an appropriate FAQ..

I am writing an app, that requires user authentication..  at the moment, it
is actually only one CGI, and judging by it's size it's unlikely I will need
to split it.. which possibly helps..

I would like to set up authentication, so that people have to log in to use
it..  my usuall method is to use .htaccess, but this is quite a pain, as you
then have to maintain usernames/passwords accross all the different
subdomains etc..

The script resides in a mod_perl alias folder, and access-levels I can deal
with internally, but the actual password protection I am a little unsure
about..

Is it best to:
 - use .htaccess, and use a CGI (if you know of one) that allows managment
of users...
 - use a PerlHandler script to do the auth?
 - some other thing...

The server has an Admin system built in, which uses a perl-handler, and sets
up / manages the server users...(along with everything else)...  I was
thinking of binding into this, but 2 probs.. 1 - the user Groups do not
really reflect the access rights I wish to give out, so I would have to add
another group, which means hacking appart the server admin cgi's... 2 - this
ties it to being used on this particular server..


Anyway... any advice or right-direction-pointing would be great...

Thanks in advance,


Jimbo





Re: Scripts and passwd

2002-05-19 Thread Stas Bekman

[EMAIL PROTECTED] wrote:
 Hello
 
 Thanks for the reply. Yes this server is running mod perl :)
 
 As for risky. Well the whole point of the script system is to add a pop mail
 box for a user. But in order to do this i have to do the following:
 
 add user to the passwd/shadow file
 add user to the virtusertable and genericstable
 recompile the sendmail config files
 
 Then and only then is the new mailbox ready for use. This is the only way I
 can think of to accomplish this via an automated web proccess. I dont even
 know if you can do it any other way with out touching the passwd/shadow
 files?

You probably want this article:
Safely Empowering Your CGI Scripts
by Lincoln D. Stein
http://www.samag.com/documents/s=1286/sam03020006/

__
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: Reloading Library Files

2002-05-19 Thread Stas Bekman

Ted Prah wrote:
 Thanks Drew, I tried that, but it did not work.


What happends if you add:

PerlWarn On

in httpd.conf

or

start the script with perl -w?

any warnings?

do you test only this script alone? What happens if you add the package 
declaration and then call it using the full name? e.g.:

z.pl - test script which calls entry_point in z_lib.pl
---
#!/usr/local/bin/perl -w
use strict;

require '/home/cgi-bin/z_lib.pl';

My::Z::entry_point();
---


z_lib.pl
--
package My::Z;
use strict;

sub entry_point {

 my $r = Apache-request;
 $r-content_type('text/html');
 $r-send_http_header;

 print HERE 1;
 #print   HERE 2;

}


 Ted
 
 Drew Taylor wrote:
 
 
Have you tried moving the PerlInitHandler  PerlSetVar up and out of the
Location directive, making it global for the server? I'm not sure that
would fix it, but it's worth a try.

Drew

At 02:37 PM 5/17/02 -0400, Ted Prah wrote:

I have tried Apache::Reload as well, but I get the same results.

Ted

Drew Taylor wrote:


Take a look at Apache::Reload or Apache::StatINC. Reload is more flexible,
but StatINC has been around a little longer. Both have worked well for me.
But be sure that you don't use these modules on a production server. :-)

httpd.conf
==
PerlInitHandler Apache::Reload

Drew

At 01:38 PM 5/17/02 -0400, Ted Prah wrote:

Hi,

I am new to mod_perl and am having problems seeing the
changes made to library files.  Must I restart the server every
time I change a library file in order to see my changes?  My
test code and environment is below.

==
Drew Taylor  |  Freelance web development using
http://www.drewtaylor.com/   |  perl/mod_perl/MySQL/postgresql/DBI
mailto:[EMAIL PROTECTED]   |  Email jobs at drewtaylor.com
--
Speakeasy.net: A DSL provider with a clue. Sign up today.
http://www.speakeasy.net/refer/29655
==
 
 
 --
 Ted Prah
 NetCasters, Inc.
 Phone:  978.887.2100 x44
 Fax:  978.887.6750
 [EMAIL PROTECTED]
 



-- 


__
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: Scripts and passwd

2002-05-19 Thread Philip Mak

On Sun, May 19, 2002 at 03:56:43AM -0500, [EMAIL PROTECTED] wrote:
 As for risky. Well the whole point of the script system is to add a pop mail
 box for a user. But in order to do this i have to do the following:
 
 add user to the passwd/shadow file
 add user to the virtusertable and genericstable
 recompile the sendmail config files
 
 Then and only then is the new mailbox ready for use. This is the only way I
 can think of to accomplish this via an automated web proccess. I dont even
 know if you can do it any other way with out touching the passwd/shadow
 files?

If all you want to do is give out POP3 mailboxes, you can accomplish
this by doing something at the MTA (Mail Transport Agent, aka mail
server) level.

For example, installing qmail (http://www.lifewithqmail.org/lwq.html)
with qmail-pop3d [note: qmail replaces sendmail] and VMailMgr
(http://www.vmailmgr.org/). Under this configuration, adding a new
POP3 mailbox would involve just changing files owned by a normal user
of the system (instead of root).

Advantages of my solution:
- Increased security. Everything in your mailbox system would be owned
  by an unpriviledged user of the system rather than root.
- qmail/Maildir is generally higher performance than sendmail/mbox.

Disadvantages of my solution:
- You have to replace sendmail with qmail and relearn some stuff.
  Be prepared to spend a few hours figuring stuff out.

 You could migrate to a database based mail authentication solution.
 Postfix+cyrus springs to mind.

The above is also a valid way to do it, with similar advantages and
disadvantages as my solution. (Postfix replaces sendmail.)



Re: Scripts and passwd

2002-05-19 Thread Peter Bi

 I dont even
 know if you can do it any other way with out touching the passwd/shadow
 files?

Do you run this for internet or your intranet accounts ? If for internet,
try something different (e.g. Courier/IMAP.)

If for intranet, and if you have to stay with Pop3, there is no way but to
touch the password file. If you don't mind a web-based mail, a possible
solution may like this: 1) set up a normal web-based membership service; 2)
write a mail filter; 3) catch every email and check if the recipient is in
your database, (yes) ? move the mail to the DB : normal mailbox.

Well, I think someone's in this maillist may have already such a system and
can share their experience. On the other hand, while this has a lot to do
with Perl, it has little with mod_Perl.


Peter

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, May 19, 2002 1:56 AM
Subject: Re: Scripts and passwd



 Hello

 Thanks for the reply. Yes this server is running mod perl :)

 As for risky. Well the whole point of the script system is to add a pop
mail
 box for a user. But in order to do this i have to do the following:

 add user to the passwd/shadow file
 add user to the virtusertable and genericstable
 recompile the sendmail config files

 Then and only then is the new mailbox ready for use. This is the only way
I
 can think of to accomplish this via an automated web proccess. I dont even
 know if you can do it any other way with out touching the passwd/shadow
 files?

 Thanks! John.

  You're doing something pretty risky there. the passwd/shadow files are
 only
  writable by root. So I suppose that when running them from the command
 line
  you run them as root. Apache doesn't run as root (its children which
serve
  the requests atleast), so mod_perl (I suppose you *are* using mod_perl?
If
  not, this is more appropriate for another newsgroup) won't either.
 
  If you can run your script as CGI, you could use suEXEC. But really,
 really
  consider the security implications of what you're doing there before
  allowing users to trash your machine very fast...
 
 
  --
  Per Einar Ellefsen
  [EMAIL PROTECTED]
 
 






Re: Modifying @INC via startup.pl

2002-05-19 Thread Gregory Matthews

I added the below STDER statement and did NOT see the printout either on 
screen or in my error_log file.

It sounds like then my startup.pl file is not even being loaded?  Funny 
though I can deliberately put a bogus module name or misspell use 
stric; and I will be unable to restart the server because of it.  Can 
this file be read and checked for correctness but not loaded?

Gregory

At 09:57 AM 5/19/2002 +0200, you wrote:
At 02:50 19.05.2002, Gregory Matthews wrote:
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.

Are you sure you are loading your startup.pl file before your module?
Are you sure it's getting loaded at all?
Try adding a debug statement in your startup.pl:

print STDERR 'Loading startup.pl  @INC = ', join :, @INC;

after your use lib part.

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
 
 
 
 


--
Per Einar Ellefsen
[EMAIL PROTECTED]







Re: Modifying @INC via startup.pl

2002-05-19 Thread Gregory Matthews

If I run apachectl configtest, I can see the below statement, Loading 
startup.pl..., so it appears that it is at least reading it (which I knew 
before), but for some reason, @INC does not show an updated path per my 
call, use lib qw(...); .

In addition, I am using the Apache::DBI module with the 
Apache::DBI-connect_on_init option, and even though I put in bogus 
database info, Apache starts fine with no errors?

Any ideas on what is going on?

Gregory

At 09:57 AM 5/19/2002 +0200, you wrote:
At 02:50 19.05.2002, Gregory Matthews wrote:
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.

Are you sure you are loading your startup.pl file before your module?
Are you sure it's getting loaded at all?
Try adding a debug statement in your startup.pl:

print STDERR 'Loading startup.pl  @INC = ', join :, @INC;

after your use lib part.

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
 
 
 
 


--
Per Einar Ellefsen
[EMAIL PROTECTED]







Re: Modifying @INC via startup.pl

2002-05-19 Thread Per Einar Ellefsen

At 18:57 19.05.2002, Gregory Matthews wrote:
I added the below STDER statement and did NOT see the printout either on 
screen or in my error_log file.

It sounds like then my startup.pl file is not even being loaded?  Funny 
though I can deliberately put a bogus module name or misspell use 
stric; and I will be unable to restart the server because of it.  Can 
this file be read and checked for correctness but not loaded?

Wow, now this is weird. Could you try something as simple as

file:startup.pl
--
use lib qw(/path/to/foo);
print STDERR Loading startup.pl;
1;

And then load that with PerlRequire?

Came to think of it: could you try without Apache::DB? Maybe that's the 
source of your problems.

Finally, as a quick fix to your original problem: maybe you can use PERL5LIB:

PerlSetEnv PERL5LIB /path

in your httpd.conf.

This is all I can come up with, sorry.

At 09:57 AM 5/19/2002 +0200, you wrote:
At 02:50 19.05.2002, Gregory Matthews wrote:
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.

Are you sure you are loading your startup.pl file before your module?
Are you sure it's getting loaded at all?
Try adding a debug statement in your startup.pl:

print STDERR 'Loading startup.pl  @INC = ', join :, @INC;

after your use lib part.

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
 
 
 
 

--
Per Einar Ellefsen
[EMAIL PROTECTED]





Re: Scripts and passwd

2002-05-19 Thread Tim Burden

Courier-IMAP comes with a POP server too. Plus there are Perl scripts so you
can manage mail users out of a DB..no need to touch system passwd files.
Might be fairly easy to convert these to a mod_perl setup. Plus you can take
advantage of the goodness of qmail, Maildirs, and daemontools
http://inter7.com/courierimap/


- Original Message -
From: Peter Bi [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Sunday, May 19, 2002 12:46 PM
Subject: Re: Scripts and passwd


  I dont even
  know if you can do it any other way with out touching the passwd/shadow
  files?

 Do you run this for internet or your intranet accounts ? If for internet,
 try something different (e.g. Courier/IMAP.)

 If for intranet, and if you have to stay with Pop3, there is no way but to
 touch the password file. If you don't mind a web-based mail, a possible
 solution may like this: 1) set up a normal web-based membership service;
2)
 write a mail filter; 3) catch every email and check if the recipient is in
 your database, (yes) ? move the mail to the DB : normal mailbox.

 Well, I think someone's in this maillist may have already such a system
and
 can share their experience. On the other hand, while this has a lot to do
 with Perl, it has little with mod_Perl.


 Peter

 - Original Message -
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Sunday, May 19, 2002 1:56 AM
 Subject: Re: Scripts and passwd


 
  Hello
 
  Thanks for the reply. Yes this server is running mod perl :)
 
  As for risky. Well the whole point of the script system is to add a pop
 mail
  box for a user. But in order to do this i have to do the following:
 
  add user to the passwd/shadow file
  add user to the virtusertable and genericstable
  recompile the sendmail config files
 
  Then and only then is the new mailbox ready for use. This is the only
way
 I
  can think of to accomplish this via an automated web proccess. I dont
even
  know if you can do it any other way with out touching the passwd/shadow
  files?
 
  Thanks! John.
 
   You're doing something pretty risky there. the passwd/shadow files are
  only
   writable by root. So I suppose that when running them from the command
  line
   you run them as root. Apache doesn't run as root (its children which
 serve
   the requests atleast), so mod_perl (I suppose you *are* using
mod_perl?
 If
   not, this is more appropriate for another newsgroup) won't either.
  
   If you can run your script as CGI, you could use suEXEC. But really,
  really
   consider the security implications of what you're doing there before
   allowing users to trash your machine very fast...
  
  
   --
   Per Einar Ellefsen
   [EMAIL PROTECTED]
  
  
 
 





Re: Modifying @INC via startup.pl

2002-05-19 Thread Gregory Matthews

Tom:

No, same error_log as usual.  I think this problem may have something to do 
with my host. I am on a virtual private server, not dedicated, although, 
I do have root access.

The way they configure the servers load in a portion of the mod_perl 
directives before my Location block, i.e., my vhosts.conf call looks like this:

# mod_perl setup
Alias /perl /usr/local/www/vhosts/host.com/perl
PerlSetEnv PERLDB_OPTS NonStop=1 LineInfo=/tmp/db.out AutoTrace=1 frame=2
PerlModule Apache::DB
PerlWarn On
PerlTaintCheck On
Location /perl
   PerlFixupHandler  Apache::DB
   SetHandler   perl-script
   PerlHandler   Apache::Registry
   OptionsExecCGI
   allow from all
   PerlSendHeaderOff
/Location
# end mod_perl setup

Notice that I do NOT need to call PerlModule Apache::Registry.  It is 
already loaded.

I may give up on the startup.pl file and simply add a Perl.../Perl 
section directly. Will this solve the problem?

Gregory

At 11:40 AM 5/19/2002 -0700, you wrote:


Gregory, are you _sure_ you have the right error_log ? You didn't send
mod_perl errors somewhere different from normal? That is my most common
reason for not being able to find diagnostic messages... (looking in the
normal webserver logs, or the ssl logs, as compared to the mod_perl
daemon's error logs)

On Sun, 19 May 2002, Per Einar Ellefsen wrote:

  At 18:57 19.05.2002, Gregory Matthews wrote:
  I added the below STDER statement and did NOT see the printout either on
  screen or in my error_log file.
  
  It sounds like then my startup.pl file is not even being loaded?  Funny
  though I can deliberately put a bogus module name or misspell use
  stric; and I will be unable to restart the server because of it.  Can
  this file be read and checked for correctness but not loaded?
 
  Wow, now this is weird. Could you try something as simple as
 
  file:startup.pl
  --
  use lib qw(/path/to/foo);
  print STDERR Loading startup.pl;
  1;
 
  And then load that with PerlRequire?
 
  Came to think of it: could you try without Apache::DB? Maybe that's the
  source of your problems.
 
  Finally, as a quick fix to your original problem: maybe you can use 
 PERL5LIB:
 
  PerlSetEnv PERL5LIB /path
 
  in your httpd.conf.
 
  This is all I can come up with, sorry.
 
  At 09:57 AM 5/19/2002 +0200, you wrote:
  At 02:50 19.05.2002, Gregory Matthews wrote:
  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.
  
  Are you sure you are loading your startup.pl file before your module?
  Are you sure it's getting loaded at all?
  Try adding a debug statement in your startup.pl:
  
  print STDERR 'Loading startup.pl  @INC = ', join :, @INC;
  
  after your use lib part.
  
  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
   
   
   
   
  
  --
  Per Einar Ellefsen
  [EMAIL PROTECTED]
 
 


--
[EMAIL PROTECTED]   | What I like about deadlines is the lovely
http://BareMetal.com/  | whooshing they make as they rush past.
web hosting since '95  | - Douglas Adams





Re: Modifying @INC via startup.pl

2002-05-19 Thread Gregory Matthews

Tom:

Fixed it.  I needed to add a 1; to the end of my startup.pl file. I was 
using a startup.pl file example from apache.org which did NOT have this. 
Then in doing some research, found out that it needed it.  Now the @INC is 
being updated at startup.

Thanks for your help!

Gregory

At 11:40 AM 5/19/2002 -0700, you wrote:


Gregory, are you _sure_ you have the right error_log ? You didn't send
mod_perl errors somewhere different from normal? That is my most common
reason for not being able to find diagnostic messages... (looking in the
normal webserver logs, or the ssl logs, as compared to the mod_perl
daemon's error logs)

On Sun, 19 May 2002, Per Einar Ellefsen wrote:

  At 18:57 19.05.2002, Gregory Matthews wrote:
  I added the below STDER statement and did NOT see the printout either on
  screen or in my error_log file.
  
  It sounds like then my startup.pl file is not even being loaded?  Funny
  though I can deliberately put a bogus module name or misspell use
  stric; and I will be unable to restart the server because of it.  Can
  this file be read and checked for correctness but not loaded?
 
  Wow, now this is weird. Could you try something as simple as
 
  file:startup.pl
  --
  use lib qw(/path/to/foo);
  print STDERR Loading startup.pl;
  1;
 
  And then load that with PerlRequire?
 
  Came to think of it: could you try without Apache::DB? Maybe that's the
  source of your problems.
 
  Finally, as a quick fix to your original problem: maybe you can use 
 PERL5LIB:
 
  PerlSetEnv PERL5LIB /path
 
  in your httpd.conf.
 
  This is all I can come up with, sorry.
 
  At 09:57 AM 5/19/2002 +0200, you wrote:
  At 02:50 19.05.2002, Gregory Matthews wrote:
  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.
  
  Are you sure you are loading your startup.pl file before your module?
  Are you sure it's getting loaded at all?
  Try adding a debug statement in your startup.pl:
  
  print STDERR 'Loading startup.pl  @INC = ', join :, @INC;
  
  after your use lib part.
  
  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
   
   
   
   
  
  --
  Per Einar Ellefsen
  [EMAIL PROTECTED]
 
 


--
[EMAIL PROTECTED]   | What I like about deadlines is the lovely
http://BareMetal.com/  | whooshing they make as they rush past.
web hosting since '95  | - Douglas Adams





Re: Modifying @INC via startup.pl

2002-05-19 Thread Per Einar Ellefsen

At 22:03 19.05.2002, Gregory Matthews wrote:
Tom:

Fixed it.  I needed to add a 1; to the end of my startup.pl file. I was 
using a startup.pl file example from apache.org which did NOT have this. 
Then in doing some research, found out that it needed it.  Now the @INC is 
being updated at startup.

:)

Would you mind telling us which exaple it was so that we can fix it?

At 11:40 AM 5/19/2002 -0700, you wrote:


Gregory, are you _sure_ you have the right error_log ? You didn't send
mod_perl errors somewhere different from normal? That is my most common
reason for not being able to find diagnostic messages... (looking in the
normal webserver logs, or the ssl logs, as compared to the mod_perl
daemon's error logs)

On Sun, 19 May 2002, Per Einar Ellefsen wrote:

  At 18:57 19.05.2002, Gregory Matthews wrote:
  I added the below STDER statement and did NOT see the printout either on
  screen or in my error_log file.
  
  It sounds like then my startup.pl file is not even being loaded?  Funny
  though I can deliberately put a bogus module name or misspell use
  stric; and I will be unable to restart the server because of it.  Can
  this file be read and checked for correctness but not loaded?
 
  Wow, now this is weird. Could you try something as simple as
 
  file:startup.pl
  --
  use lib qw(/path/to/foo);
  print STDERR Loading startup.pl;
  1;
 
  And then load that with PerlRequire?
 
  Came to think of it: could you try without Apache::DB? Maybe that's the
  source of your problems.
 
  Finally, as a quick fix to your original problem: maybe you can use 
 PERL5LIB:
 
  PerlSetEnv PERL5LIB /path
 
  in your httpd.conf.
 
  This is all I can come up with, sorry.
 
  At 09:57 AM 5/19/2002 +0200, you wrote:
  At 02:50 19.05.2002, Gregory Matthews wrote:
  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.
  
  Are you sure you are loading your startup.pl file before your module?
  Are you sure it's getting loaded at all?
  Try adding a debug statement in your startup.pl:
  
  print STDERR 'Loading startup.pl  @INC = ', join :, @INC;
  
  after your use lib part.
  
  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
   
   
   
   
  
  --
  Per Einar Ellefsen
  [EMAIL PROTECTED]
 
 


--
[EMAIL PROTECTED]   | What I like about deadlines is the lovely
http://BareMetal.com/  | whooshing they make as they rush past.
web hosting since '95  | - Douglas Adams



-- 
Per Einar Ellefsen
[EMAIL PROTECTED]





Re: Modifying @INC via startup.pl

2002-05-19 Thread Gregory Matthews

Tom:

Here is one of them. I think that I saw it elsewhere also.  When I come 
across the other pages, I will advise.

http://perl.apache.org/preview/modperl-site-ok/docs/1.0/guide/config.html#MinSpareServers_MaxSpareServers_StartServers_MaxClients_MaxRequestsPerChild

Thanks again Tom!

Also, here is another question:  I am putting the following in my startup 
file to initialize a db connection:

# Initialize the database connections for each child
Apache::DBI-connect_on_init
(DBI:mysql:database=test;host=localhost, user,password,
{ PrintError = 1, # warn() on errors
RaiseError = 0, # don't die on error
AutoCommit = 1, # commit executes immediately }

I am also using the $Apache::DBI::DEBUG = 2; flag to ensure it is working 
properly.

I am NOT seeing the entries in the error_log both when Apache::DBI 
initializes a connection and when it returns one from its cache.

Shouldn't I be able to see a reference to the connection in my error_log file?

I checked both my virtual host error_log file and the server error_log 
file. Nothing in either.

Gregory




At 10:21 PM 5/19/2002 +0200, you wrote:
At 22:03 19.05.2002, Gregory Matthews wrote:
Tom:

Fixed it.  I needed to add a 1; to the end of my startup.pl file. I was 
using a startup.pl file example from apache.org which did NOT have this. 
Then in doing some research, found out that it needed it.  Now the @INC 
is being updated at startup.

:)

Would you mind telling us which exaple it was so that we can fix it?

At 11:40 AM 5/19/2002 -0700, you wrote:


Gregory, are you _sure_ you have the right error_log ? You didn't send
mod_perl errors somewhere different from normal? That is my most common
reason for not being able to find diagnostic messages... (looking in the
normal webserver logs, or the ssl logs, as compared to the mod_perl
daemon's error logs)

On Sun, 19 May 2002, Per Einar Ellefsen wrote:

  At 18:57 19.05.2002, Gregory Matthews wrote:
  I added the below STDER statement and did NOT see the printout either on
  screen or in my error_log file.
  
  It sounds like then my startup.pl file is not even being loaded?  Funny
  though I can deliberately put a bogus module name or misspell use
  stric; and I will be unable to restart the server because of 
 it.  Can
  this file be read and checked for correctness but not loaded?
 
  Wow, now this is weird. Could you try something as simple as
 
  file:startup.pl
  --
  use lib qw(/path/to/foo);
  print STDERR Loading startup.pl;
  1;
 
  And then load that with PerlRequire?
 
  Came to think of it: could you try without Apache::DB? Maybe that's the
  source of your problems.
 
  Finally, as a quick fix to your original problem: maybe you can use 
 PERL5LIB:
 
  PerlSetEnv PERL5LIB /path
 
  in your httpd.conf.
 
  This is all I can come up with, sorry.
 
  At 09:57 AM 5/19/2002 +0200, you wrote:
  At 02:50 19.05.2002, Gregory Matthews wrote:
  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.
  
  Are you sure you are loading your startup.pl file before your module?
  Are you sure it's getting loaded at all?
  Try adding a debug statement in your startup.pl:
  
  print STDERR 'Loading startup.pl  @INC = ', join :, @INC;
  
  after your use lib part.
  
  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
   

Re: Modifying @INC via startup.pl

2002-05-19 Thread Gregory Matthews

Thanks for the update!

Did you get a chance to review the other question I had below?

Gregory

At 11:53 PM 5/19/2002 +0200, you wrote:

Thank you very much Gregory, I have patches the online docs.

By the way, the release-ready (almost) site is now at 
http://perl.apache.org/release/


At 23:36 19.05.2002, Gregory Matthews wrote:
Tom:

Here is one of them. I think that I saw it elsewhere also.  When I come 
across the other pages, I will advise.

http://perl.apache.org/preview/modperl-site-ok/docs/1.0/guide/config.html#MinSpareServers_MaxSpareServers_StartServers_MaxClients_MaxRequestsPerChild

Thanks again Tom!

Also, here is another question:  I am putting the following in my startup 
file to initialize a db connection:

# Initialize the database connections for each child
Apache::DBI-connect_on_init
(DBI:mysql:database=test;host=localhost, user,password,
{ PrintError = 1, # warn() on errors
RaiseError = 0, # don't die on error
AutoCommit = 1, # commit executes immediately }

I am also using the $Apache::DBI::DEBUG = 2; flag to ensure it is working 
properly.

I am NOT seeing the entries in the error_log both when Apache::DBI 
initializes a connection and when it returns one from its cache.

Shouldn't I be able to see a reference to the connection in my error_log 
file?

I checked both my virtual host error_log file and the server error_log 
file. Nothing in either.

Gregory




At 10:21 PM 5/19/2002 +0200, you wrote:
At 22:03 19.05.2002, Gregory Matthews wrote:
Tom:

Fixed it.  I needed to add a 1; to the end of my startup.pl file. I was 
using a startup.pl file example from apache.org which did NOT have 
this. Then in doing some research, found out that it needed it.  Now 
the @INC is being updated at startup.

:)

Would you mind telling us which exaple it was so that we can fix it?

At 11:40 AM 5/19/2002 -0700, you wrote:


Gregory, are you _sure_ you have the right error_log ? You didn't send
mod_perl errors somewhere different from normal? That is my most common
reason for not being able to find diagnostic messages... (looking in the
normal webserver logs, or the ssl logs, as compared to the mod_perl
daemon's error logs)

On Sun, 19 May 2002, Per Einar Ellefsen wrote:

  At 18:57 19.05.2002, Gregory Matthews wrote:
  I added the below STDER statement and did NOT see the printout 
 either on
  screen or in my error_log file.
  
  It sounds like then my startup.pl file is not even being 
 loaded?  Funny
  though I can deliberately put a bogus module name or misspell use
  stric; and I will be unable to restart the server because of 
 it.  Can
  this file be read and checked for correctness but not loaded?
 
  Wow, now this is weird. Could you try something as simple as
 
  file:startup.pl
  --
  use lib qw(/path/to/foo);
  print STDERR Loading startup.pl;
  1;
 
  And then load that with PerlRequire?
 
  Came to think of it: could you try without Apache::DB? Maybe that's the
  source of your problems.
 
  Finally, as a quick fix to your original problem: maybe you can use 
 PERL5LIB:
 
  PerlSetEnv PERL5LIB /path
 
  in your httpd.conf.
 
  This is all I can come up with, sorry.
 
  At 09:57 AM 5/19/2002 +0200, you wrote:
  At 02:50 19.05.2002, Gregory Matthews wrote:
  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.
  
  Are you sure you are loading your startup.pl file before your module?
  Are you sure it's getting loaded at all?
  Try adding a debug statement in your startup.pl:
  
  print STDERR 'Loading startup.pl  @INC = ', join :, @INC;
  
  after your use lib part.
  
  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 

make test problem

2002-05-19 Thread Jie Gao

Hi All,

uname -a:

Linux xxx 2.4.17-02-shuckle #8 Thu Apr 18 13:15:58 EST 2002 i686 unknown

I've found Apache 2.0.36 doesn't work with mod_perl-1.99_01 on redhat 7.1.

With apache 2.0.35, I'm getting:

make test

...

/usr/bin/perl -Iblib/arch/Apache2 -Iblib/lib/Apache2 \
t/TEST -clean
setting ulimit to allow core files
ulimit -c unlimited; t/TEST -clean
APACHE_USER= APXS= APACHE_PORT= APACHE_GROUP= APACHE= \
/usr/bin/perl -Iblib/arch/Apache2 -Iblib/lib/Apache2 \
t/TEST
setting ulimit to allow core files
ulimit -c unlimited; t/TEST
/usr/local/apache2/bin/httpd  -d /export/src/mod_perl-1.99_01/t -f 
/export/src/mod_perl-1.99_01/t/conf/httpd.conf
-DAPACHE2
using Apache/2.0.35 (prefork MPM)
waiting for server to start: 00:00Syntax error on line 11 of 
/export/src/mod_perl-1.99_01/t/conf/httpd.conf:
Cannot load /usr/local/apache2/modules/mod_rewrite.so into server: 
/usr/local/apache2/modules/mod_rewrite.so:
undefined symbol: apr_group_name_get

server has died with status 1 (t/logs/error_log wasn't created, start the server in 
the debug mode)
make: *** [run_tests] Error 143


httpd was configured as:

./configure \
--prefix=/usr/local/apache2 \
--with-mpm=prefork \
--enable-so \
--enable-mods-shared=mod_rewrite \
--enable-module=most

Any ideas?




Jie




Re: make test problem

2002-05-19 Thread Doug MacEachern

On Mon, 20 May 2002, Jie Gao wrote:
 
 I've found Apache 2.0.36 doesn't work with mod_perl-1.99_01 on redhat 7.1.

you can use modperl from cvs with .36 or wait for modperl 1.99_02 
(sometime this week).
 
 With apache 2.0.35, I'm getting:
...
 Cannot load /usr/local/apache2/modules/mod_rewrite.so into server:
 /usr/local/apache2/modules/mod_rewrite.so:
 undefined symbol: apr_group_name_get

looks like mod_rewrite that was compiled with .36 is still in the .35 
install tree.





Re: make test problem

2002-05-19 Thread Jie Gao

On Sun, 19 May 2002, Doug MacEachern wrote:

 On Mon, 20 May 2002, Jie Gao wrote:

  I've found Apache 2.0.36 doesn't work with mod_perl-1.99_01 on redhat 7.1.

 you can use modperl from cvs with .36 or wait for modperl 1.99_02
 (sometime this week).

Just got one from cvs and 'make test' hangs on apr/util:

/usr/bin/perl -Iblib/arch/Apache2 -Iblib/lib/Apache2 \
t/TEST -clean
*** setting ulimit to allow core files
ulimit -c unlimited; t/TEST -clean
APACHE_USER= APXS= APACHE_PORT= APACHE_GROUP= APACHE= \
/usr/bin/perl -Iblib/arch/Apache2 -Iblib/lib/Apache2 \
t/TEST
*** setting ulimit to allow core files
ulimit -c unlimited; t/TEST
/usr/local/apache2/bin/httpd  -d /export/src/modperl-2.0/t -f 
/export/src/modperl-2.0/t/conf/httpd.conf -DAPACHE2
using Apache/2.0.36 (prefork MPM)

waiting for server to start: ok (waited 0 secs)
server localhost.localdomain:8529 started
server localhost.localdomain:8530 listening (TestDirective::perlrequire)
server localhost.localdomain:8531 listening (TestDirective::perlmodule)
server localhost.localdomain:8532 listening (TestProtocol::echo)
server localhost.localdomain:8533 listening (TestProtocol::echo_filter)
server localhost.localdomain:8534 listening (TestProtocol::eliza)
server localhost.localdomain:8535 listening (TestFilter::input_msg)
apache/cgihandler...ok
apache/compat...ok
apache/compat2..ok
apache/conftree.ok
apache/constantsok
apache/post.ok
apache/read.ok
apache/scanhdrs.ok
apache/subprocess...skipped: perl  5.7.3
apache/writeok
api/access..ok
api/aplog...ok
api/conn_recok
api/lookup_uri..ok
api/lookup_uri2.ok
api/module..ok
api/r_subclass..ok
api/request_rec.ok
api/responseok
api/rutil...ok
api/send_fd.ok
api/sendfileok
api/server_rec..ok
api/server_util.ok
api/uri.ok
apr/base64..ok
apr/constants...ok
apr/dateok
apr/netlib..ok
apr/perlio..skipped: iolayers is not available with this version of Perl
apr/poolok
apr/string..ok
apr/table...ok
apr/util


perl -V

Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
  Platform:
osname=linux, osvers=2.4.17-0.13smp, archname=i386-linux
uname='linux daffy.perf.redhat.com 2.4.17-0.13smp #1 smp fri feb 1 10:30:48 est 
2002 i686 unknown '
config_args='-des -Doptimize=-O2 -march=i386 -mcpu=i686 -Dcc=gcc -Dcf_by=Red Hat, 
Inc. -Dcccdlflags=-fPIC
-Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux -Uusethreads -Uuseithreads 
-Uuselargefiles -Dd_dosuid
-Dd_semctl_semun -Di_db -Di_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm 
-Dlocincpth='
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
useperlio=undef d_sfio=undef uselargefiles=undef usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
  Compiler:
cc='gcc', ccflags ='-fno-strict-aliasing -I/usr/local/include',
optimize='-O2 -march=i386 -mcpu=i686',
cppflags='-fno-strict-aliasing -I/usr/local/include'
ccversion='', gccversion='2.96 2731 (Red Hat Linux 7.1 2.96-98)', 
gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4
alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -ldl -lm -lc -lcrypt -lutil
perllibs=-lnsl -ldl -lm -lc -lcrypt -lutil
libc=/lib/libc-2.2.4.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl):
  Compile-time options:
  Built under linux
  Compiled at Feb 20 2002 15:01:16
  INC:
/usr/lib/perl5/5.6.1/i386-linux
/usr/lib/perl5/5.6.1
/usr/lib/perl5/site_perl/5.6.1/i386-linux
/usr/lib/perl5/site_perl/5.6.1
/usr/lib/perl5/site_perl


Regards,



Jie

  With apache 2.0.35, I'm getting:
 ...
  Cannot load /usr/local/apache2/modules/mod_rewrite.so into server:
  /usr/local/apache2/modules/mod_rewrite.so:
  undefined symbol: apr_group_name_get

 looks like mod_rewrite that was compiled with .36 is still in the .35
 install tree.








Apache::Leak

2002-05-19 Thread Gregory Matthews

Hello again.

Is Apache::Leak the easiest/best module to use for both detecting AND 
allowing us to find the source of a memory leak in mod_perl?

If so, I am not finding any good documentation on its use.  I am not a 
mod_perl guru and what I've read so far sounds rather involved.

Can someone point me to a location where good, laymen documentation exists 
for this module. I would love to use it to ensure my code is solid (I am 
writing a mod_perl app from scratch and do not want to stray off the wrong 
coding path).

Thanks in advance.

Gregory





Memory Leaks

2002-05-19 Thread Gregory Matthews

I have a couple of questions regarding leaking memory in mod_perl:

1.  What are the main culprits, in order of severity, of memory leaks, i.e.:

a.  global variables (NOT lexically scoped via my)
b.  ...
c.  ...

2.  When writing code from scratch (a new application), what is the best 
way to avoid creating leaks to begin with, i.e., use strict;, PerlWarn On, 
etc.. ?

I posted an earlier question regarding Apache::Leak which I am hoping to 
receive some positive input. I would like to check my final product once 
completed to ensure no leaks exist.

Thanks everyone.

Gregory
  





Re: Memory Leaks

2002-05-19 Thread Perrin Harkins

 I have a couple of questions regarding leaking memory in mod_perl:

 1.  What are the main culprits, in order of severity, of memory leaks,
i.e.:

 a.  global variables (NOT lexically scoped via my)
 b.  ...
 c.  ...

 2.  When writing code from scratch (a new application), what is the
best
 way to avoid creating leaks to begin with, i.e., use strict;, PerlWarn
On,
 etc.. ?

There are actually not very many ways you can leak memory in Perl (and
thus mod_perl).  Most people confuse memory growth with memory leakage.
If you want to know how to avoid memory growth, look at the performance
tuning stuff in the Guide, like passing references, avoiding slurping of
large files, controlling the buffering of DBI result sets, etc.

Leaks are caused by circular references, the string form of eval (at
least it used to leak a little), nested closures (sometimes created
accidentally with the Error module), and one or two obscure syntax
problems.  I think one of them involved code like my $x = 7 if $y;.
Matt Sergeant got bitten by this in the early stages of AxKit
development, and the details are in the mailing list archive.

Global variables by themselves are not a source of leaks or growth.  If
you slurp a large file into a global, your process will grow, but the
same is true for a lexical.

- Perrin




sending CGI ouput through a handler

2002-05-19 Thread Allen Day

Okay, I realize this has probably been covered before, but I couldn't find
anything in the archive...

I have a configuration like this:

Location /
  SetHandler perl-script
  PerlHandler My::Handler
/Location

My::Handler takes the requested file and adds some markup to it with the
Template Toolkit if the MIMEtype of the file is text/html.  I want to be
able to use the same handler to also add markup to the output of executed
CGI.  What is the best way to do this?

Should I set up a separate location for the CGI (I'm doing this,
actually) ?  Are there any extra directives needed?

TIA
Allen




Setting require in Authentication handler?

2002-05-19 Thread Todd Chapman


Can dir_config be used to set 'require' in an authentication handler?

I would then return DECLINED do that Apache's Basic auth handler would do
the heavy lifting of checking the password.

Thanks!

-Todd





Re: Memory Leaks

2002-05-19 Thread Gregory Matthews

So am I being overly paranoid concerning the leak potential of mod_perl 
programming?

If I start with strict code to begin with and try my best to stay away 
from the problems you mentioned, then any potential memory leak/drain 
issues will be avoided?

Keep in mind, although my application is not designed to launch the space 
shuttle, I do want it to be solid/stable/peformance-packed from the ground up.

I will be also be using MySql with the Apache::DBI module.

Thanks in advance.

Gregory


At 11:34 PM 5/19/2002 -0400, you wrote:
  I have a couple of questions regarding leaking memory in mod_perl:
 
  1.  What are the main culprits, in order of severity, of memory leaks,
i.e.:
 
  a.  global variables (NOT lexically scoped via my)
  b.  ...
  c.  ...
 
  2.  When writing code from scratch (a new application), what is the
best
  way to avoid creating leaks to begin with, i.e., use strict;, PerlWarn
On,
  etc.. ?

There are actually not very many ways you can leak memory in Perl (and
thus mod_perl).  Most people confuse memory growth with memory leakage.
If you want to know how to avoid memory growth, look at the performance
tuning stuff in the Guide, like passing references, avoiding slurping of
large files, controlling the buffering of DBI result sets, etc.

Leaks are caused by circular references, the string form of eval (at
least it used to leak a little), nested closures (sometimes created
accidentally with the Error module), and one or two obscure syntax
problems.  I think one of them involved code like my $x = 7 if $y;.
Matt Sergeant got bitten by this in the early stages of AxKit
development, and the details are in the mailing list archive.

Global variables by themselves are not a source of leaks or growth.  If
you slurp a large file into a global, your process will grow, but the
same is true for a lexical.

- Perrin





Re: Memory Leaks

2002-05-19 Thread Doran L. Barton

Not long ago, Gregory Matthews proclaimed...
 So am I being overly paranoid concerning the leak potential of mod_perl 
 programming?

No... But once you do it right it comes natural. 

The thing that killed me when I first started doing mod_perl development
was code that pushed items onto lists in Apache::Registry scripts. I wasn't
initializing those list variables and before you knew it, lists were
getting populated with values in duplicate, triplicate, and so on.

Nothing has helped me become a better Perl programming than mod_perl. :)

-=Fozz

-- 
Doran L. Barton [EMAIL PROTECTED] - Chief Super Hero - Iodynamics LLC
 http://www.iodynamics.com/  - Linux solutions and dynamic websites
 Dog for sale: eats anything and is fond of children.
-- Classified ad in newspaper



Re: Memory Leaks

2002-05-19 Thread Perrin Harkins

 So am I being overly paranoid concerning the leak potential of
mod_perl
 programming?

No, memory management is very important with mod_perl.

 If I start with strict code to begin with and try my best to stay
away
 from the problems you mentioned, then any potential memory leak/drain
 issues will be avoided?

Using strict is an absolute must for many reasons.  It won't prevent you
from using up tons of memory though.  You have to become tuned in to the
things that use up memory so that you can avoid them.  Start with the
Guide.

- Perrin




Re: sending CGI ouput through a handler

2002-05-19 Thread Perrin Harkins

 My::Handler takes the requested file and adds some markup to it with
the
 Template Toolkit if the MIMEtype of the file is text/html.  I want to
be
 able to use the same handler to also add markup to the output of
executed
 CGI.  What is the best way to do this?

You can't feed the output of mod_cgi to mod_perl, at least not in Apache
1.x.  The best thing to do (at least for performance) would be to
rewrite the CGI so that you call it as a module from your handler.
Another approach would be to use Apache::Filter to grab the output from
PerlRun or Regsistry.  You could also sublass PerlRun or Registry and
add your handler code to it.

- Perrin




Re: Apache::Leak

2002-05-19 Thread Stas Bekman

Gregory Matthews wrote:
 Hello again.
 
 Is Apache::Leak the easiest/best module to use for both detecting AND 
 allowing us to find the source of a memory leak in mod_perl?
 
 If so, I am not finding any good documentation on its use.  I am not a 
 mod_perl guru and what I've read so far sounds rather involved.
 
 Can someone point me to a location where good, laymen documentation 
 exists for this module. I would love to use it to ensure my code is 
 solid (I am writing a mod_perl app from scratch and do not want to stray 
 off the wrong coding path).

There is not much documentation online regarding this. But as Perrin has 
replied in the other thread, you should worry much about leaks, when you 
don't mess with circular references, autovivified variables and reset 
your globals.

Here is the relevant section from our book, which should be published 
really soon now. It looks like the book is going to be called Practical 
mod_perl. If you notice some wrong/unclear details or missing things, 
please let me know while we still can correct things.

=head2 Memory Leakage

It's normal for a process to grow when it processes its first few
requests.  They may be different requests, or the same requests
processing different data.  You may try to reload the same request a
few times and in many cases the process will stop growing after only
the second reload.  In any case, once a representative selection of
requests and inputs have been executed by a process, it won't usually
grow any more unless the code leaks memory.  If it grows after each
reload of an identical request, then there is probably a memory leak.

The experience might be different if the code works with some external
resource which can change between requests.  For example if the code
retrieves database records matching some query, it's possible that
from time to time the database will be updated and that a different
number of records will match the same query the next time it is
issued.  Depending on the techniques which you use to retrieve the
data, format it and send it to the user, the process may grow more or
less in size reflecting the changes in the data.

The easiest way to see whether the code is leaking is to run the
server in single process mode (Chttpd -X), issuing the same request
a few times and see whether the process grows after each request.  If
it does, you probably have a memory leak.  If the code leaks 5kB per
request, after 1000 requests to run the leaking code there will be 5MB
of memory leaked.  If in production you have 20 processes then this
could possibly lead to 100MB of leakage after a few tens of thousands
of requests.

This technique to detect leakage can be misleading if you are not
careful.  Suppose your process first runs some clean (non-leaking)
code which acquires 100kB of memory.  In an attempt to make itself
more efficient, Perl doesn't give the 100kB memory back to the
operating system.  The next time the process runs Iany script, some
of the 100kB will be reused.  But if this time the process runs a
script that needs to acquire only 5kB, you won't see the process grow
even if the code has actually leaked these 5kB.  Now it might take 20
or more requests for the leaking script Iserved by the same process
before you would see that process start growing again.

A process may leak memory for several reasons: badly written system
C/C++ libraries used in the httpd binary and badly written Perl code
are the most common.  Perl modules may also use C libraries, and these
might leak memory as well.  Some operating systems have been known to
have problems with their memory management functions.

If you know that you have no leaks in your code, for detecting leaks
in C/C++ libraries you should either use the technique of sampling the
memory usage described above, or use C/C++ developer tools designed
for this purpose.  This topic is beyond the scope of this book.

The CApache::Leak module (derived from CDevel::Leak) might help
you to detect leaks in your code.  For example:

   file:leaktest.pl
   
   use Apache::Leak;

   my $global = FooA;

   leak_test {
   $$global = 1;
   ++$global;
   };

The argument to Cleak_test() is an anonymous sub or a block, so you
can just throw in any code you suspect might be leaking.  Beware, it
will run the code twice!  The first time in, new CSVs are created,
but this does not mean the code is leaking.  The second pass will give
better evidence.  You do not need to be inside mod_perl to use it.
 From the command line, the above script outputs:

   ENTER: 1482 SVs
   new c28b8 : new c2918 :
   LEAVE: 1484 SVs
   ENTER: 1484 SVs
   new db690 : new db6a8 :
   LEAVE: 1486 SVs
   !!! 2 SVs leaked !!!

This module uses the simple approach of walking the Perl internal
table of allocated IScalar Values (SVs).  It records them before
entering the scope of the code under test and after leaving the scope.
At the end a comparison of the two sets is performed, sv_dump() is

Re: sending CGI ouput through a handler

2002-05-19 Thread Allen Day

  My::Handler takes the requested file and adds some markup to it with
 the
  Template Toolkit if the MIMEtype of the file is text/html.  I want to
 be
  able to use the same handler to also add markup to the output of
 executed
  CGI.  What is the best way to do this?

 You can't feed the output of mod_cgi to mod_perl, at least not in Apache
 1.x.  The best thing to do (at least for performance) would be to
 rewrite the CGI so that you call it as a module from your handler.
 Another approach would be to use Apache::Filter to grab the output from
 PerlRun or Regsistry.  You could also sublass PerlRun or Registry and
 add your handler code to it.

So what about in Apache 2.x ?  Is there a way to address this?  I'm trying
to convert a site that has lots of independent CGI to one that contains
the output of said CGI in a set of templates.  I'd rather not have to
make modifications to the existing CGI to bring them in.

-Allen




Re: sending CGI ouput through a handler

2002-05-19 Thread Stas Bekman

Allen Day wrote:
 Okay, I realize this has probably been covered before, but I couldn't find
 anything in the archive...
 
 I have a configuration like this:
 
 Location /
   SetHandler perl-script
   PerlHandler My::Handler
 /Location
 
 My::Handler takes the requested file and adds some markup to it with the
 Template Toolkit if the MIMEtype of the file is text/html.  I want to be
 able to use the same handler to also add markup to the output of executed
 CGI.  What is the best way to do this?
 
 Should I set up a separate location for the CGI (I'm doing this,
 actually) ?  Are there any extra directives needed?

by CGI do you mean a script running under mod_cgi? If it's registry you 
should be able to use stacked handlers:
http://perl.apache.org/release/docs/1.0/guide/config.html#Stacked_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




Re: make test problem

2002-05-19 Thread Stas Bekman

Jie Gao wrote:

 Just got one from cvs and 'make test' hangs on apr/util:

please run in the verbose mode:

t/TEST -v apr/util

if it doesn't help to reveal the problem try to enable tracing:
http://perl.apache.org/release/docs/2.0/user/config/config.html#General_directives
or attach with gdb and send us the trace of where it hangs.

__
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: sending CGI ouput through a handler

2002-05-19 Thread Stas Bekman

Allen Day wrote:
My::Handler takes the requested file and adds some markup to it with

the

Template Toolkit if the MIMEtype of the file is text/html.  I want to

be

able to use the same handler to also add markup to the output of

executed

CGI.  What is the best way to do this?

You can't feed the output of mod_cgi to mod_perl, at least not in Apache
1.x.  The best thing to do (at least for performance) would be to
rewrite the CGI so that you call it as a module from your handler.
Another approach would be to use Apache::Filter to grab the output from
PerlRun or Regsistry.  You could also sublass PerlRun or Registry and
add your handler code to it.
 
 
 So what about in Apache 2.x ?  Is there a way to address this? 

Yes, you will be able to, thanks to I/O filters. See the mod_perl 2.0 
test suite under t/filter/.

 I'm trying
 to convert a site that has lots of independent CGI to one that contains
 the output of said CGI in a set of templates.  I'd rather not have to
 make modifications to the existing CGI to bring them in.

Run them under Apache::Registry or PerlRun. Then use Apache::Filter as 
Perrin has suggested. My suggestions of using stacked handlers may work 
too with a custom subclass of Apache::RegistryNG.

__
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: Apache::Leak

2002-05-19 Thread Matt Sergeant

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Monday 20 May 2002 2:47 am, Gregory Matthews wrote:
 Hello again.

 Is Apache::Leak the easiest/best module to use for both detecting AND
 allowing us to find the source of a memory leak in mod_perl?

No - it's a nightmare.

To debug memory leaks in AxKit, everything is wrapped in eval{}, and I simply 
run ab (ships with apache) on my site watching the memory size (in top), and 
move a line throwing an exception steadily forward through the code line by 
line until the leak reveals itself.

Sounds painful, and it is, but it's a *lot* easier than Apache::Leak, which 
reports way too many false positives.

- -- 
:-get a SMart net/:-
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE86JLuVBc71ct6OywRAh78AJ90I+h4zsp3ecBcmKUoKHPb1EaNQgCgsFxK
ZmbS8TEvbnbLTEsknbQ10Zk=
=nJBs
-END PGP SIGNATURE-