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

2003-01-22 Thread stas
stas2003/01/22 16:31:28

  Modified:src/modules/perl mod_perl.c mod_perl.h modperl_filter.c
modperl_util.h
   .Changes
   xs/Apache/RequestIO Apache__RequestIO.h
   xs/Apache/SubRequest Apache__SubRequest.h
   xs/tables/current/ModPerl FunctionTable.pm
  Log:
  - add a new MP_FAILURE_CROAK macro to handle failures
  - all response functions are now returning status and the callers check
  and croak on failure or progate them further.
  
  Revision  ChangesPath
  1.147 +10 -4 modperl-2.0/src/modules/perl/mod_perl.c
  
  Index: mod_perl.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.c,v
  retrieving revision 1.146
  retrieving revision 1.147
  diff -u -r1.146 -r1.147
  --- mod_perl.c12 Jan 2003 02:15:58 -  1.146
  +++ mod_perl.c23 Jan 2003 00:31:28 -  1.147
  @@ -709,12 +709,12 @@
   wb-r = r;
   }
   
  -void modperl_response_finish(request_rec *r)
  +apr_status_t modperl_response_finish(request_rec *r)
   {
   MP_dRCFG;
   
   /* flush output buffer */
  -modperl_wbucket_flush(rcfg-wbucket);
  +return modperl_wbucket_flush(rcfg-wbucket);
   }
   
   static int modperl_response_handler_run(request_rec *r, int finish)
  @@ -730,7 +730,10 @@
   }
   
   if (finish) {
  -modperl_response_finish(r);
  +apr_status_t rc = modperl_response_finish(r);
  +if (rc != APR_SUCCESS) {
  +retval = rc;
  +}
   }
   
   return retval;
  @@ -803,7 +806,10 @@
   #endif
   
   /* flush output buffer after interpreter is putback */
  -modperl_response_finish(r);
  +apr_status_t rc = modperl_response_finish(r);
  +if (rc != APR_SUCCESS) {
  +retval = rc;
  +}
   
   switch (rcfg-status) {
 case HTTP_MOVED_TEMPORARILY:
  
  
  
  1.56  +1 -1  modperl-2.0/src/modules/perl/mod_perl.h
  
  Index: mod_perl.h
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.h,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- mod_perl.h12 Dec 2002 10:05:08 -  1.55
  +++ mod_perl.h23 Jan 2003 00:31:28 -  1.56
  @@ -88,7 +88,7 @@
   void xs_init(pTHX);
   
   void modperl_response_init(request_rec *r);
  -void modperl_response_finish(request_rec *r);
  +apr_status_t modperl_response_finish(request_rec *r);
   int modperl_response_handler(request_rec *r);
   int modperl_response_handler_cgi(request_rec *r);
   
  
  
  
  1.45  +5 -6  modperl-2.0/src/modules/perl/modperl_filter.c
  
  Index: modperl_filter.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.c,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- modperl_filter.c  17 Jan 2003 03:08:31 -  1.44
  +++ modperl_filter.c  23 Jan 2003 00:31:28 -  1.45
  @@ -23,6 +23,8 @@
   ap_log_error(APLOG_MARK, APLOG_WARNING,
0, r-server, %s did not send an HTTP header,
r-uri);
  +/* XXX: bodytext == NULL here */
  +return status;
   }
   else if (!bodytext) {
   return APR_SUCCESS;
  @@ -190,17 +192,14 @@
* first modperl_input_filter_read, so it must be
* destroyed at the end of the filter invocation
*/
  -/* XXX: may be the filter must consume all the data? add a
  - * test to check */
   apr_brigade_destroy(filter-bb_in);
   filter-bb_in = NULL;
   }
  -modperl_input_filter_flush(filter);
  +MP_FAILURE_CROAK(modperl_input_filter_flush(filter));
   }
   else {
  -modperl_output_filter_flush(filter);
  +MP_FAILURE_CROAK(modperl_output_filter_flush(filter));
   }
  -
   
   return status;
   }
  @@ -457,7 +456,7 @@
   
   if (filter-flush  len == 0) {
   /* if len  0 then $filter-write will flush */
  -modperl_output_filter_flush(filter);
  +MP_FAILURE_CROAK(modperl_output_filter_flush(filter));
   }
   
   return len;
  
  
  
  1.38  +7 -0  modperl-2.0/src/modules/perl/modperl_util.h
  
  Index: modperl_util.h
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.h,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- modperl_util.h11 Jan 2003 00:02:16 -  1.37
  +++ modperl_util.h23 Jan 2003 00:31:28 -  1.38
  @@ -50,6 +50,13 @@
   #define MP_magical_tie(sv, mg_flags) \
   SvFLAGS((SV*)sv) |= mg_flags
   
  +#define 

cvs commit: modperl-2.0 Makefile.PL Changes

2003-01-22 Thread stas
stas2003/01/22 21:16:30

  Modified:.Makefile.PL Changes
  Log:
  the top level 'make test' now descends into the ModPerl-Registry dir
  to run 'make test' there
  
  Revision  ChangesPath
  1.90  +24 -1 modperl-2.0/Makefile.PL
  
  Index: Makefile.PL
  ===
  RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
  retrieving revision 1.89
  retrieving revision 1.90
  diff -u -r1.89 -r1.90
  --- Makefile.PL   11 Jan 2003 03:20:54 -  1.89
  +++ Makefile.PL   23 Jan 2003 05:16:30 -  1.90
  @@ -29,7 +29,6 @@
   use Apache::TestReportPerl ();
   use Apache::TestSmokePerl ();
   use Apache::TestTrace;
  -use Apache::TestMM qw(test);
   use ModPerl::TestRun ();
   use ModPerl::Code ();
   use ModPerl::MM ();
  @@ -442,6 +441,30 @@
   ModPerl::MM::add_dep(\$string, clean = 'modperl_src_clean');
   ModPerl::MM::add_dep(\$string, clean = 'test_clean');
   $string;
  +}
  +
  +sub MY::test {
  +
  +my $env = Apache::TestConfig-passenv_makestr();
  +
  +my $preamble = Apache::TestConfig::WIN32 ?  : EOF;
  +PASSENV = $env
  +EOF
  +
  +return $preamble . 'EOF';
  +test_clean :
  + $(FULLPERL) -I$(INST_ARCHLIB) -I$(INST_LIB) \
  + t/TEST -clean
  + 
  +run_tests : test_clean
  + $(PASSENV) \
  + $(FULLPERL) -I$(INST_ARCHLIB) -I$(INST_LIB) \
  + t/TEST
  + cd ModPerl-Registry  make test
  +
  +test :: pure_all run_tests test_clean
  +EOF
  +
   }
   
   sub MY::postamble {
  
  
  
  1.112 +3 -0  modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.111
  retrieving revision 1.112
  diff -u -r1.111 -r1.112
  --- Changes   23 Jan 2003 04:06:38 -  1.111
  +++ Changes   23 Jan 2003 05:16:30 -  1.112
  @@ -10,6 +10,9 @@
   
   =item 1.99_09-dev
   
  +the top level 'make test' now descend into the ModPerl-Registry dir
  +to run 'make test' there [Stas]
  +
   Apache::Test: don't inherit loading of the mod_perl object from the
   system-wide config, since we already add it [Stas]
   
  
  
  



PerlSwitches -M and @INC

2003-01-22 Thread Helmut Zeilinger
Hi,

i am trying Apache 2.0.44 and mod_perl 1.99_08.

httpd.conf :Bevor all virtual hosts

PerlRequire /usr/local/apache2/conf/virtual/startup.pl

The content of startup.pl is as in the mod_perl documentation including
the use Apache::compat() directive.

I one of my V-hosts i say (as described in the documentation):

PerlOptions +Parent

PerlSwitches -Mlib=/et/www/envirotex/lib  

When I start the server i get the error message:


[Wed Jan 22 13:52:07 2003] [error] Can't locate loadable object for
module Apache::Constants in @INC (@INC contains: /et/www/envirotex/lib
/usr/lib/perl5/5.8.0/i686-linux-thread-multi /usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl/5.6.1
/usr/lib/perl5/site_perl .) at
/usr/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi/mod_perl.pm line
14
Compilation failed in require at
/usr/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi/Apache.pm line 6.
BEGIN failed--compilation aborted at
/usr/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi/Apache.pm line 6.
Compilation failed in require at
/et/www/envirotex/lib/Emma/AuthCookieHandler.pm line 3.
BEGIN failed--compilation aborted at
/et/www/envirotex/lib/Emma/AuthCookieHandler.pm line 3.
Compilation failed in require at (eval 1) line 3.

[Wed Jan 22 13:52:07 2003] [error] Can't load Perl module
Emma::AuthCookieHandler for server www.et:0, exiting...


It seems to me, that all of the Apache2 paths create by the use
Apache2 directive are no more present in the @INC Array.

I tried a lot of things with several combinations of PerlSwitches (-M,
-I, -Mblib, -Mlib), and startup files, but I never got the result i
want:

I would like to load some private Modules under
/et/www/envirotex/lib and all the other things should work too. 


Helmut








[MP2] pb with startup.pl and LibXML

2003-01-22 Thread [EMAIL PROTECTED]
Hi I have 

SERVER_SOFTWARE: Apache/2.0.43 (Win32) mod_perl/1.99_08-dev 
Perl/v5.8.0 PHP/4.3.0 

installed from theoryx5 all-in-one archive


here is the problem I have :
-
package testxml;
use strict;
use warnings;

use XML::LibXML();
use XML::LibXSLT();
use Data::Dumper;

my $base='c:/apache2/mason';

my $promod=
XML::LibXSLT-new-parse_stylesheet(
XML::LibXML-new-parse_file($base/stylesheets/test.xsl));
print Dumper $promod ;
1;
---

the above script runs ok when PERL testxml.pm is run. (outside 
of any apache environment)
Dumper prints 

bless XML::LibXSLT::Stylesheet.. 

showing
all parsing ok (the stylesheets is simplisssima one tag sheet)

when it is USEed from startup.pl (# removed below in startup) 
then
it also prints the line 

bless ... 

but apache issues a fatal error and refuses to 
start instruction 0X28027104 memory cant be read !


here is the startup.pl

use Apache2 ();
use lib 'c:/apache2/mason/lib';
use ModPerl::Util ();
use Apache::RequestRec ();
use Apache::RequestIO ();
use Apache::RequestUtil ();
use Apache::Server ();
use Apache::ServerUtil ();
use Apache::Connection ();
use Apache::Log ();
use Apache::Const -compile = ':common';
use APR::Const -compile = ':common';
use APR::Table ();
use Apache::compat ();
use ModPerl::Registry ();
use CGI ();
use XML::LibXML();
use XML::LibXSLT();
#use testxml;
1;


same thing if  you omit the xslt step in the testxml script

I pointed out this problem from the early distribution of 
modperl2, it's not recent.


thanks 

pascal

Accédez au courrier électronique de La Poste : www.laposte.net ; 
3615 LAPOSTENET (0,13 €/mn) ; tél : 08 92 68 13 50 (0,34€/mn)






Re: [MP2] pb with startup.pl and LibXML

2003-01-22 Thread Randy Kobes
On Wed, 22 Jan 2003, [iso-8859-1] [EMAIL PROTECTED] wrote:

 Hi I have 
 
 SERVER_SOFTWARE: Apache/2.0.43 (Win32) mod_perl/1.99_08-dev 
 Perl/v5.8.0 PHP/4.3.0 
 
 installed from theoryx5 all-in-one archive
 
 
 here is the problem I have :
 -
 package testxml;
 use strict;
 use warnings;
 use XML::LibXML();
 use XML::LibXSLT();
 use Data::Dumper;
 my $base='c:/apache2/mason';
 my $promod=
 XML::LibXSLT-new-parse_stylesheet(
 XML::LibXML-new-parse_file($base/stylesheets/test.xsl));
 print Dumper $promod ;
 1;
 ---
 
 the above script runs ok when PERL testxml.pm is run. (outside 
 of any apache environment)
 Dumper prints 
 
 bless XML::LibXSLT::Stylesheet.. 
 
 showing
 all parsing ok (the stylesheets is simplisssima one tag sheet)
 
 when it is USEed from startup.pl (# removed below in startup) 
 then
 it also prints the line 
 
 bless ... 
 
 but apache issues a fatal error and refuses to 
 start instruction 0X28027104 memory cant be read !
 
 
 here is the startup.pl
 
 use Apache2 ();
 use lib 'c:/apache2/mason/lib';
 use ModPerl::Util ();
 use Apache::RequestRec ();
 use Apache::RequestIO ();
 use Apache::RequestUtil ();
 use Apache::Server ();
 use Apache::ServerUtil ();
 use Apache::Connection ();
 use Apache::Log ();
 use Apache::Const -compile = ':common';
 use APR::Const -compile = ':common';
 use APR::Table ();
 use Apache::compat ();
 use ModPerl::Registry ();
 use CGI ();
 use XML::LibXML();
 use XML::LibXSLT();
 #use testxml;
 1;
 
 
 same thing if  you omit the xslt step in the testxml script
 
 I pointed out this problem from the early distribution of 
 modperl2, it's not recent.

Is it just when used from the startup file that problems
arise? Does it run OK within Apache as, eg, part of
a registry script? And if not, is it OK within an ordinary
cgi script?

Does adding a
LoadFile /Path/to/libxml2.dll
directive, before pulling in the startup script, help?
(in the distribution from our site, libxml2.dll is in
the Perl/bin/ directory).

-- 
best regards,
randy




mysql password encryption

2003-01-22 Thread Martin Moss
All,

I wish to let a user use the same password for them to authenticate to a
multitude of mysql Databases AND to authenticate themselves on my modperl
site.
the problem I have is that I store the password in the database as a
Password field. However when I wish to use DBI to connect to another mysql
database I cannot use the Password stored in the database as it comes out
encrypted.  I really don't want to store the unencrypted password anywhere
on the system. Is there a way to let DBI/mysql know that the password I am
giving them is ALREADY encrypted?

Has anybody else solved a problem like this?

Regards

Marty




Re: mysql password encryption

2003-01-22 Thread Perrin Harkins
Martin Moss wrote:

the problem I have is that I store the password in the database as a
Password field. However when I wish to use DBI to connect to another mysql
database I cannot use the Password stored in the database as it comes out
encrypted.  I really don't want to store the unencrypted password anywhere
on the system. Is there a way to let DBI/mysql know that the password I am
giving them is ALREADY encrypted?


Why don't you just encrypt it yourself and store it in a VARCHAR?

- Perrin




Re: mysql password encryption

2003-01-22 Thread Cees Hek
Quoting Martin Moss [EMAIL PROTECTED]:

 All,
 
 I wish to let a user use the same password for them to authenticate to a
 multitude of mysql Databases AND to authenticate themselves on my modperl
 site.
 the problem I have is that I store the password in the database as a
 Password field. However when I wish to use DBI to connect to another mysql
 database I cannot use the Password stored in the database as it comes out
 encrypted.  I really don't want to store the unencrypted password anywhere
 on the system. Is there a way to let DBI/mysql know that the password I am
 giving them is ALREADY encrypted?

A feature like that would defeat the purpose of encrypting the password in the
first place.  The point of encrypting the password is so that if someone gets
their hands on the password list, they can not use the encrypted password to
access the system.  They would have to crack the passwords first before using
them to access the system.

By allowing someone to access the system with an already encrypted password,
then your passwords might as well not be encrypted at all.

Since you are using MySQL, have you looked at using the mysql_read_default_file
option to store your password in a config file?  Using a DSN like the following
allows you to keep the username and password in a config file.  Check the
DBD::mysql perldocs for more info, and the MySQL docs for all the parameters you
can put in such a file.

DBI:mysql:test;mysql_read_default_file=/etc/mysql/test.my.conf

and in /etc/mysql/test.my.conf

[client]
user = www
password = thebigsecretpassword

Then protect the file:

chown www /etc/mysql/test.my.conf
chmod 400 /etc/mysql/test.my.conf

You still have the password in plain text, but it is readable only by root and
the user that runs the webserver.  You can use this to connect to multiple MySQL
servers as long as the access tokens are the same on all servers.

Cees



Re: [MP2] pb with startup.pl and LibXML

2003-01-22 Thread [EMAIL PROTECTED]

Does adding a
LoadFile /Path/to/libxml2.dll
directive, before pulling in the startup script, help?
(in the distribution from our site, libxml2.dll is in
the Perl/bin/ directory).

-- 
best regards,
randy


I have no libxml2.dll file from the all-in-one 30 or so MB 
archive donwloaded from theoryx5

i only have libxml.dll in perl/site/lib/auto/xml/libxml



I do have one libxml2.dll in my path from a separate xmlsoft 
download... maybe this is the reason of problems ?

apache issues the segfault (popup window) on every situation : 
mason modperl,
registry or simple cgi. 

but then it restarts itself immediatly and serves the request 
(after a rather long restarting delay).

the segfault sometimes does not happen for two or three times 
and then again.


pascal



Accédez au courrier électronique de La Poste : www.laposte.net ; 
3615 LAPOSTENET (0,13 €/mn) ; tél : 08 92 68 13 50 (0,34€/mn)






Re: Re: [MP2] pb with startup.pl and LibXML

2003-01-22 Thread Randy Kobes
On Wed, 22 Jan 2003, [iso-8859-1] [EMAIL PROTECTED] wrote:

  Does adding a
LoadFile /Path/to/libxml2.dll
  directive, before pulling in the startup script, help?
  (in the distribution from our site, libxml2.dll is in
  the Perl/bin/ directory).

 I have no libxml2.dll file from the all-in-one 30 or so MB 
 archive donwloaded from theoryx5

Sorry for the confusion - I got mixed up with distributions.

 i only have libxml.dll in perl/site/lib/auto/xml/libxml

 I do have one libxml2.dll in my path from a separate xmlsoft 
 download... maybe this is the reason of problems ?

That might be  You might try an upgraded LibXML/LibXSLT
package from http://theoryx5.uwinnipeg.ca/ppms/ - this has fixed
a couple of bugs. Both of these require XML-LibXML-Common, which
does contain the libxml2.dll referred to above. The dll is, in
theory, supposed to be installed from a post-install script under
ppm, but this might not work within ppm3 - if one is using ppm3,
one can grab XML-LibXML-Common.tar.gz from
http://theoryx5.uwinnipeg.ca/ppms/x86/ and extract libxml2.dll
from there. This dll should go somewhere within the PATH, and is
the one I suggested to load with the LoadFile directive.


 apache issues the segfault (popup window) on every situation : 
 mason modperl, registry or simple cgi. 

 but then it restarts itself immediatly and serves the request 
 (after a rather long restarting delay).

 the segfault sometimes does not happen for two or three times 
 and then again.

Weird 

-- 
best regards,
randy




server startup shutdown

2003-01-22 Thread dima
I have XML  file
and don`t want parse/serialize on each request
how implement this:
1) XML parsed on startup
2) All modules work whith same object
3) XML serialize on server shutdown


P.S. Apache 2 mod_perl 2








Re: [mp2] Apache::RequestRec, IPC::Open[23] problem

2003-01-22 Thread Ville Skyttä
On Wed, 2003-01-22 at 08:10, Stas Bekman wrote:

 Please try again with the latest cvs, I've just ported FILENO, OPEN and CLOSE 
 interfaces from 1.0. Though I doubt that this will work, IPC::Open* have 
 always had problems with mod_perl. IPC::Run should be used instead for now. 
 Hopefully will be able to look more into this issue much later unless someone 
 beats me to it.

Thanks for the quick reply, Stas.  I tried it out and that particular
error is gone now, but the W3C Validator still doesn't quite work,
whereas as a normal CGI it does.  I didn't notice any errors, but valid
pages just don't validate under mod_perl (they do as normal CGI).  I
know this is a too vague explanation, but I don't have time to dig
deeper now.

Cheers,
-- 
\/ille Skyttä
ville.skytta at iki.fi





Re: server startup shutdown

2003-01-22 Thread Perrin Harkins
[EMAIL PROTECTED] wrote:

I have XML  file
and don`t want parse/serialize on each request
how implement this:
1) XML parsed on startup
2) All modules work whith same object


It doesn't look to me like you can share objects across threads 
effectively at this time.  You can share a hash ref, but that doesn't 
share things tha are referenced within that hash and it doesn't share 
the blessing.

I think you will need to do this using standard data sharing methods, 
like IPC::MM or MLDBM::Sync.

3) XML serialize on server shutdown


That sounds dangerous.  What happens if your server crashes or otherwise 
shuts down abnormally?  You will lose everything.  Much safer to write 
your updates to disk, even if you only do it with Storable or 
MLDBM::Sync and then transform it back to XML later.

- Perrin



Configuration in module vs in apacheconfig...

2003-01-22 Thread Marcin Kasperski
{ yes, I saw the chapter in Stas Bekman's book, that's not exactly
  what I discuss }

So, there is some mod_perl application. It has a lot of configurable
elements - from urls being used to constants predefining contents of
different drop-down boxes.

Currently the config information is spread between:
- apache config file included to httpd.conf (let's call it myapp.conf),
  where different urls and directories are both mapped to handlers
  and PerlSetVar'ed so the application can use them when needed,
  log formats are defined etc
- separated application module (let's call it MyConfig.pm), where 
  the things like lookup contents, default field values, customizable
  validation criteria or database passwords are kept

I would like to integrate those two.

After some initial consideration I found, that moving config from
MyConfig.pm to myapp.conf does not seem to be reasonable. Imagine
PerlSetVar'ing arrays and hashes which can refer one to another...

Currently I think about the opposite: putting everything configurable
and writing apache config in the style like:

Perl
use MyConfig.pm;

$PerlRequire = $MyConfig::InstallDir . '/startup.pl';

$PerlConfig .= ENDCONF;
  Location $MyConfig::SomeUrl
  $MyConfig::accessSettings
  SetHandler perl-script
  PerlHandler myapp::Handler::Some
  Location
  Location $MyConfig::OtherUrl
  $MyConfig::accessSettings
  SetHandler perl-script
  PerlHandler myapp::Handler::Other
  Location
ENDCONF

if($MyConfig::Debug) {
  $LogLevel = 'debug';
  $PerlConfig .= PerlWarn On\n;
} else {
  $LogLevel = 'warn';
}

/Perl

(and more, and more, the above is just a sample to show what I am
 thinking about, in fact most of the apache config would be done this
 way)

The questions are:

1) As I checked, it seems that such a config would more-or-less
   work. But I am a bit afraid of the restart semantics. How can
   apache behave when graceful-ed or restart-ed having such a
   configuration? Would it be same or different when mod_perl is
   DSO'ed and when is statically linked?

2) I found that some Set*Handler directives are processed differently
   when specified in myapp.conf and when specified in perl with
   Apache-push_handlers (in particular the RestartHandler specified
   with push_handlers was not executed while restart although it was
   called on startup). Should I be afraid of anything similar after
   following such a config change?

3) Do you think that this is the good/bad idea from any other reasons?



[JOB SEEKER]: Looking for consulting work

2003-01-22 Thread Dave Rolsky
Hello, mod_perl folks,

I've recently decided it's time to go the consulting route and I'm looking
for consulting gigs.  I have quite a bit of experience with mod_perl, and
Mason especially, plus database design, application design, and much more.
I'm open to short or long term projects, including design, coding, code
review, and training.

I have a spiffy web site at http://www.houseabsolute.com/, which has more
details on what I can do, as well as my resume and a list of some previous
clients.

Outright gifts of cash, bearer bonds, brand new cars, or other valuables
are also welcome.


-dave

/*===
House Absolute Consulting
www.houseabsolute.com
===*/



Re: Configuration in module vs in apacheconfig...

2003-01-22 Thread Perrin Harkins
Marcin Kasperski wrote:

After some initial consideration I found, that moving config from
MyConfig.pm to myapp.conf does not seem to be reasonable. Imagine
PerlSetVar'ing arrays and hashes which can refer one to another...


If you can do it in a module, you can do it in myapp.conf.

Perl
package MyConfigPackage;
use vars qw($complex_var);

$complex_var = { 'foo' = [ 'bar', 'baz' ] };
/Perl

Personally, I've been pretty happy to keep two config files, since the 
distinction seems pretty clear to me.

- Perrin



Re: [mp2] Apache::RequestRec, IPC::Open[23] problem

2003-01-22 Thread Stas Bekman
Ville Skyttä wrote:

On Wed, 2003-01-22 at 08:10, Stas Bekman wrote:



Please try again with the latest cvs, I've just ported FILENO, OPEN and CLOSE 
interfaces from 1.0. Though I doubt that this will work, IPC::Open* have 
always had problems with mod_perl. IPC::Run should be used instead for now. 
Hopefully will be able to look more into this issue much later unless someone 
beats me to it.


Thanks for the quick reply, Stas.  I tried it out and that particular
error is gone now, but the W3C Validator still doesn't quite work,
whereas as a normal CGI it does.  I didn't notice any errors, but valid
pages just don't validate under mod_perl (they do as normal CGI).  I
know this is a too vague explanation, but I don't have time to dig
deeper now.


As I said, the IPC::Open* family is usually not working under mod_perl (1.0 
and 2.0). Nobody has looked into resolving this issue, mainly because IPC::Run 
seems to be a much better alternative. But that doesn't solve the problem for 
those who are stuck with an existing code and aren't able to adjust it. 
Therefore since IPC::Run provides the same functionality and more, may be a 
special IPC::Open* layer can be provided which will transparently replace 
IPC::Open* with IPC::Run.

__
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: PerlSwitches -M and @INC

2003-01-22 Thread Stas Bekman
Helmut Zeilinger wrote:

Hi,

i am trying Apache 2.0.44 and mod_perl 1.99_08.

httpd.conf :Bevor all virtual hosts

	PerlRequire /usr/local/apache2/conf/virtual/startup.pl

The content of startup.pl is as in the mod_perl documentation including
the use Apache::compat() directive.

I one of my V-hosts i say (as described in the documentation):

	PerlOptions +Parent

	PerlSwitches -Mlib=/et/www/envirotex/lib  

When I start the server i get the error message:


[Wed Jan 22 13:52:07 2003] [error] Can't locate loadable object for
module Apache::Constants in @INC (@INC contains: /et/www/envirotex/lib
/usr/lib/perl5/5.8.0/i686-linux-thread-multi /usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl/5.6.1
/usr/lib/perl5/site_perl .) at
/usr/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi/mod_perl.pm line
14
Compilation failed in require at
/usr/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi/Apache.pm line 6.
BEGIN failed--compilation aborted at
/usr/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi/Apache.pm line 6.
Compilation failed in require at
/et/www/envirotex/lib/Emma/AuthCookieHandler.pm line 3.
BEGIN failed--compilation aborted at
/et/www/envirotex/lib/Emma/AuthCookieHandler.pm line 3.
Compilation failed in require at (eval 1) line 3.

[Wed Jan 22 13:52:07 2003] [error] Can't load Perl module
Emma::AuthCookieHandler for server www.et:0, exiting...


It seems to me, that all of the Apache2 paths create by the use
Apache2 directive are no more present in the @INC Array.

I tried a lot of things with several combinations of PerlSwitches (-M,
-I, -Mblib, -Mlib), and startup files, but I never got the result i
want:

I would like to load some private Modules under
/et/www/envirotex/lib and all the other things should work too. 

That's because you get a completely new interpreter. So you have to run 
Apache2 again

  PerlOptions +Parent
  PerlModule Apache2

Does that work for you?

I agree that this is not-intuitive and adds to a clutter. I suppose that this 
should be documented for the time being. And hopefully by the time 2.0 is 
released we will come up with a transparent solution.

Have you tried using the +Clone option instead?
http://perl.apache.org/docs/2.0/user/config/config.html#C_Clone_

__
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



Apache::SessionManager pnotes index.html problem...

2003-01-22 Thread Joseph P. Crotty
Here is the simplest form of the problem I can produce.

I have two handlers and want to pass some info between them visa vi pnotes.  One
is a PerlTransHandler for Apache::SessionManager and the other is a PerlHandler
for a simple Hello.pm that dumps some html with the current _session_start value
(i.e. from pnotes).  Apache::SessionManager checks to see if a session file
exists, creates one if not, and updates pnotes appropriately.

The problem - if I request index.html there is no value in pnotes for
_session_start as confirmed by Hello.pm.  It seems that there is nothing in
pnotes period.  If after the request I manually inspect the session file created
I find a value for _session_start.  Request other pages (e.g. test.html) and
there are expected pnotes entries confirmed by Hello.pm.

Apache 1.3.27 mod_perl

httpd.conf snippet
#START mod_perl Configuration
#
PerlRequire conf/startup.pl
PerlSetEnv  MOD_PERL_TRACE all

PerlSetEnv  SERVER_ROOT /usr/local/apache/
#--
#END mod_perl Configuration


#START Apache::SessionManager Configuration
#--
PerlModule Apache::SessionManager
PerlTransHandler Apache::SessionManager
#
#END Apache::SessionManager Configuration


#START Block Directives
#--
Location /
SetHandler perl-script
PerlSetVar SessionManagerDebug 0
PerlSetVar SessionManagerTracking On
PerlSetVar SessionManagerExpire 3600
PerlSetVar SessionManagerStore File
PerlSetVar SessionManagerStoreArgs Directory =
/usr/local/apache/session, \
LockDirectory =
/usr/local/apache/session/lock
/Location

Directory /usr/local/apache/htdocs
Files ~ index.html$
SetHandler perl-script
PerlHandler MyApache::Hello
/Files

Files ~ test.html$
SetHandler perl-script
PerlHandler MyApache::Hello
/Files
/Directory

Alias /perl/ /usr/local/apache/perl/

Directory /perl
AllowOverride  None
Options+ExecCGI
SetHandler perl-script
PerlHandlerApache::Registry
PerlSendHeader On
/Directory
#
#END Block Directives
/httpd.conf snippet

Hello.pm
package MyApache::Hello;

use strict;
use Apache::Constants qw(:common);

sub handler {
my $r = shift;
$r-content_type('text/html');
$r-send_http_header;

my $host = $r-get_remote_host;
my $href_session = $r-pnotes('SESSION_MANAGER_HANDLE');
unless ($href_session) {
print STDERR nada\n;
}
my $sess_start = $href_session-{'_session_start'};
$r-print(END);
HTML
HEAD
TITLEHello There/TITLE
/HEAD
BODY
H1Hello $host/H1
H2Sessoin Start: $sess_start/H2
/BODY
/HTML
END

return OK;
}
1;
/Hello.pm





cvs commit: modperl Makefile.PL Changes

2003-01-22 Thread stas
stas2003/01/22 20:25:05

  Modified:.Makefile.PL Changes
  Log:
  use $Config{'installstyle'} instead of hardcoded 'lib', to handle
  Makefile.PL's PREFIX option correctly
  Submitted by: Philippe M. Chiasson [EMAIL PROTECTED]
  Reviewed by:  stas
  
  Revision  ChangesPath
  1.205 +1 -1  modperl/Makefile.PL
  
  Index: Makefile.PL
  ===
  RCS file: /home/cvs/modperl/Makefile.PL,v
  retrieving revision 1.204
  retrieving revision 1.205
  diff -u -r1.204 -r1.205
  --- Makefile.PL   19 Jun 2002 16:31:52 -  1.204
  +++ Makefile.PL   23 Jan 2003 04:25:04 -  1.205
  @@ -347,7 +347,7 @@
   if ($k eq 'PREFIX') {
   require File::Spec;
   $MOD_PERL_PREFIX =
  -  File::Spec-catfile($v, 'lib', 'site_perl',
  +  File::Spec-catfile($v, $Config{'installstyle'}, 'site_perl',
 $Config{'version'}, $Config{'archname'});
   }

  
  
  
  1.659 +4 -0  modperl/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl/Changes,v
  retrieving revision 1.658
  retrieving revision 1.659
  diff -u -r1.658 -r1.659
  --- Changes   25 Dec 2002 01:46:09 -  1.658
  +++ Changes   23 Jan 2003 04:25:04 -  1.659
  @@ -10,6 +10,10 @@
   
   =item 1.27_01-dev
   
  +use $Config{'installstyle'} instead of hardcoded 'lib', to handle
  +Makefile.PL's PREFIX option correctly [Philippe M. Chiasson
  +[EMAIL PROTECTED]]
  +
   prevent segfaults in mod_perl_mark_where() when a sub can't get
   resolved [Gerald Richter [EMAIL PROTECTED]]