mod_perl httpd doesn't start as DSO

2003-11-26 Thread BeerBong
Hello!

I wanted to build a debian package of apache for my specific purposes.
My specific purpose is mod_accel support.
I downloaded a source for apache debian package (apache-1.3.26)
from stable distribution, add mod_accel patches and it
have been compiled well.

These are config options and flags:
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O1 \
-DEAPI_MM=SYSTEM -DEAPI_MM_CORE_PATH=\"/var/run/apache.mm\" \
-lmm

--target=apache --with-layout=Debian \
--enable-suexec --suexec-caller=www-data \
--suexec-docroot=/var/www --includedir=/$(inc) \
--suexec-logfile=/var/log/apache/suexec.log \
--without-confadjust --without-execstrip \
--enable-shared=max --enable-rule=SHARED_CHAIN \
--enable-module=most --enable-module=status \
--enable-module=auth_digest --enable-module=log_referer \
--enable-module=log_agent --enable-module=auth_db \
--activate-module=src/modules/accel/libaccel.a \
--enable-shared=accel \
--activate-module=src/modules/extra/mod_macro.c
---

Also I've installed mod_perl debian package - libapache-mod-perl_1.26,
which was compiled be mantainer with apxs:

Makefile.PL USE_APXS=1 WITH_APXS=/usr/bin/apxs \
PERL_SECTIONS=1 PERL_SSI=1 PERL_METHOD_HANDLERS=1 ALL_HOOKS=1 \
PERL_TIE_TABLES=1 PERL_DIRECTIVE_HANDLERS=1 PERL_STACKED_HANDLERS=1 \
PERL_TRACE=0 PERL_LOG_API=1 PERL_URI_API=1 PERL_UTIL_API=1 \
PERL_TABLE_API=1 PERL_FILE_API=1 \
INSTALLDIRS=vendor PERL_DEBUG=1

I added PERL_DEBUG later...

I'm using front and backend installation and starts two instance
of apache with mod_accel and mod_perl support.

apachectl -DSIMPLE (with mod_accel)
starts normal
apachectl -DPOWER (with mod_perl)
says that httpd started, but there is no any httpd processes
with POWER functionality

warzavod:/etc/apache# gdb /usr/sbin/apache-power
GNU gdb 2002-04-01-cvs
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-linux"...
(gdb) set args -X -DPOWER
(gdb) run
Starting program: /usr/sbin/apache -X -DPOWER
perl_parse args: '/dev/null' ...allocating perl interpreter...ok
constructing perl interpreter...ok
PerlPassEnv: `ORACLE_HOME'=`/u01/app/oracle/product/8.1.7'
PerlPassEnv: `NLS_LANG'=`AMERICAN_AMERICA.CL8MSWIN1251'
PerlPassEnv:
`ORA_NLS'=`/u01/app/oracle/product/8.1.7/ocommon/nls/admin/data'
running perl interpreter...ok
mod_perl: 0 END blocks encountered during server startup
PerlRequire: arg=`startup.pl'
attempting to require `startup.pl'
loading perl module 'Apache::Constants::Exports'...ok
[New Thread 1024 (LWP 15551)]

Program received signal SIGABRT, Aborted.
[Switching to Thread 1024 (LWP 15551)]
0x40107781 in kill () from /lib/libc.so.6
(gdb) where
#0  0x40107781 in kill () from /lib/libc.so.6
#1  0x40373cd3 in Perl_my_unexec () from /usr/lib/libperl.so.5.6
#2  0x403e3210 in Perl_pp_goto () from /usr/lib/libperl.so.5.6
#3  0x403e2510 in Perl_pp_dump () from /usr/lib/libperl.so.5.6
#4  0x403ba401 in Perl_runops_standard () from /usr/lib/libperl.so.5.6
#5  0x40372b1c in S_call_body () from /usr/lib/libperl.so.5.6
#6  0x40372cbe in perl_eval_sv () from /usr/lib/libperl.so.5.6
#7  0x40331bab in perl_do_file () from /usr/lib/apache/1.3/mod_perl.so
#8  0x40331c4c in perl_load_startup_script () from
/usr/lib/apache/1.3/mod_perl.so
#9  0x4032cb03 in perl_cmd_require () from /usr/lib/apache/1.3/mod_perl.so
#10 0x08054f09 in invoke_cmd (cmd=0x40350cd8, parms=0xb5a0,
mconfig=0x8096b00, args=0xbfffd522 "")
at http_config.c:946
#11 0x0805528a in ap_handle_command (parms=0xb5a0, config=0x808a490,
l=0xbfffd50c "PerlRequire startup.pl")
at http_config.c:1079
#12 0x080552d1 in ap_srm_command_loop (parms=0xb5a0, config=0x808a490)
at http_config.c:1093
#13 0x08055802 in ap_process_resource_config (s=0x8089f58, fname=0x8082980
"/etc/apache/httpd.conf", p=0x8089f30,
ptemp=0x808df60) at http_config.c:1355
#14 0x08055efc in ap_read_config (p=0x8089f30, ptemp=0x808df60,
confname=0x8082980 "/etc/apache/httpd.conf")
at http_config.c:1647
#15 0x0805e4d8 in main (argc=3, argv=0xb6e4) at http_main.c:5528

I dont know what to do now...

Thanx in advance
--
Sergey Polyakov aka BeerBong
Chief of WebZavod http://www.webzavod.ru
Tel. +7 (8462) 43-93-85 | +7 (8462) 43-93-86
  mailto:[EMAIL PROTECTED]


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: very old bug report about internal_redirect

2003-11-26 Thread Pierfrancesco Caci
:-> "Geoffrey" == Geoffrey Young <[EMAIL PROTECTED]> writes:

>> > looks like you added the :method tag to bug130883::Redir::handler(),
>> > which wasn't originally a method handler in the code you posted:
>> Uh, sorry. I corrected it and now I get this one:
>> [Wed Nov 12 16:23:05 2003] [error] Can't call method "content_type"
>> on
>> an undefined value at /usr/local/lib/site_perl/bug130883/Impl1.pm line
>> 10.

> good, that's the same error.  well, not good, but ok :)


>> The Debian Apache maintainer prepared me a patched version that I'll try as
>> soon as possible.

> cool.


Ok, here are the promised tests, apologies for the long delay:

Fabbione patched mod_perl and these are the results:

with "sub handler($$) {"  :


[Wed Nov 26 09:18:46 2003] [error] Can't call method "content_type" on
an undefined value at /usr/local/lib/site_perl/bug130883/Impl1.pm line
10.

with "sub handler : method  {" :

[Wed Nov 26 09:25:30 2003] [error] Can't call method "content_type" on
an undefined value at /usr/local/lib/site_perl/bug130883/Impl1.pm line
10.


So there is no change whatsoever using the 2 styles. 


Ciao

Pf


-- 

---
 Pierfrancesco Caci | ik5pvx | mailto:[EMAIL PROTECTED]  -  http://gusp.dyndns.org
  Firenze - Italia  | Office for the Complication of Otherwise Simple Affairs 
 Linux penny 2.6.0-test9 #1 Fri Oct 31 22:51:12 CET 2003 i686 GNU/Linux


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: mod_perl httpd doesn't start as DSO

2003-11-26 Thread Stas Bekman
BeerBong wrote:
Hello!

I wanted to build a debian package of apache for my specific purposes.
My specific purpose is mod_accel support.
I downloaded a source for apache debian package (apache-1.3.26)
from stable distribution, add mod_accel patches and it
have been compiled well.
[...]
Program received signal SIGABRT, Aborted.
[Switching to Thread 1024 (LWP 15551)]
0x40107781 in kill () from /lib/libc.so.6
As you can see from the trace if fails when loading your startup file. You 
want to find the offensive line that triggers this failure. One way to do it 
is to go one frame up:

(gdb) where
#0  0x40107781 in kill () from /lib/libc.so.6
#1  0x40373cd3 in Perl_my_unexec () from /usr/lib/libperl.so.5.6
(gdb) up

and then ask perl where it was when the problem has happened.

(gdb) printf "%d:%s\n", PL_curcop->cop_line, 
((XPV*)(*(XPVGV*)PL_curcop->cop_filegv->sv_any)->xgv_gp->gp_sv->sv_any)->xpv_pv

This is with non-threaded perl, you didn't send the output of 'perl -V' as you 
are being suggested to at http://perl.apache.org/bugs/, so in case your perl 
is threaded, you will want to run:

(gdb) printf "%d:%s\n", my_perl->Tcurcop->cop_line, my_perl->Tcurcop->cop_file

__
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
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Web Portal And WorkFlo System Developed With Embperl

2003-11-26 Thread Stas Bekman
[EMAIL PROTECTED] wrote:
Hi:

There is a project called EplSite, this project use EmbPerl and mod_perl.
[...]
http://www.eplsite.org/en/index.epl?module=News;option=read;sid=1
Carlos, if you are interested, we can add your project to this page:
http://perl.apache.org/products/products.html
Just tell me what and where should it be added (even better send a patch against
http://perl.apache.org/products/products.html.orig)
__
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
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Data lost when browser refreshed

2003-11-26 Thread Stas Bekman
Sorry, Tom, looks like this message fell between the cracks. Fishing it out now.

Tom Conway wrote:
I got these errors when I did perl MakeFile.pl for mod_perl-1.99_11
I have a standard redhat 8.0 install with the latest rpms.
DO I need to uninstall apache, mod_perl and do a source install?
I'm afraid of chasing this all over the place.

APXS doesn't appear to be on my system.

* WARNING *

 Your Perl is configured to link against libgdbm,
 but libgdbm.so was not found.
 You could just symlink it to /usr/lib/libgdbm.so.2.0.0
* WARNING *
!!! Unable to determine server version, aborting.
!!! Please specify MP_APXS or MP_AP_PREFIX.
APXS (/usr/sbin/apxs) query for SBINDIR failed
APXS (/usr/sbin/apxs) query for TARGET failed
APXS (/usr/sbin/apxs) query for SYSCONFDIR failed
You don't show what did you do. Please see:
 http://perl.apache.org
You will need to install Apache 2.0.46 or higher (get 2.0.48 if you can). You 
should be able to find RH rpms here:
http://www.rpmfind.net/linux/rpm2html/search.php

__
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
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: PerlSetVar with '0' value

2003-11-26 Thread Enrico Sorcinelli
On Tue, 25 Nov 2003 15:34:16 -0500
Geoffrey Young <[EMAIL PROTECTED]> wrote:

> Enrico Sorcinelli wrote:
> > Hi all,
> >> 
> > I have this PerlSetVar behaviour. Suppose to have:
> > 
> > 
> > SetHander perl-script
> > PerlSetVar Something 0
> > PerlResponseHandler MyModule
> > 
> > 
> > But in MyModule.pm, $r->dir_config('Something') returns an undef value instead
> > of 0 (zero). This happens on both mod_perl generations (I have Perl 5.8.1 with mp
> > 1.29 and mp 1.99_10).
> 
> this is fixed in current mod_perl 2.0 cvs - please give it a whirl.  

Thanks, I'll do it.

> I'll take a look at 1.0 "soonish" but it may never get fixed there, depending 
> on how intricate the change is.  we want to fix bugs, of course, but we also
> don't want to upset the stable tree for little things, so we treat it with
> much more care :)

Yes, I know :-)
If this little fix will not be inserted in the mp1 tree, there isn't problem:
I'll apply the patch locally, where necessary.

by

- Enrico


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: PerlSetVar with '0' value

2003-11-26 Thread Enrico Sorcinelli
On Tue, 25 Nov 2003 15:47:07 -0500
Geoffrey Young <[EMAIL PROTECTED]> wrote:

> > I'll
> > take a look at 1.0 "soonish" 
> 
> it looks like the logic is pretty much the same in 1.0 as well.
> 
> please try this (untested) patch and let me know if it fixes things for you.
> 
> --Geoff
> 
> Index: src/modules/perl/Apache.xs
> ===
> RCS file: /home/cvspublic/modperl/src/modules/perl/Apache.xs,v
> retrieving revision 1.129
> diff -u -r1.129 Apache.xs
> --- src/modules/perl/Apache.xs  16 Sep 2003 19:51:06 -  1.129
> +++ src/modules/perl/Apache.xs  25 Nov 2003 20:39:41 -
> @@ -2084,7 +2084,7 @@
>  &perl_module);
> TABLE_GET_SET(c->vars, FALSE);
>  }
> -if (!SvTRUE(RETVAL)) {
> +if (!SvOK(RETVAL)) {
> s = r && r->server ? r->server : perl_get_startup_server();
> if (s && s->module_config) {
> SvREFCNT_dec(RETVAL); /* in case above did newSV(0) */
> 

Hi Geoff,
the patch seems to work fine.
I've applied it over mp 1.29 (with Apache 1.3.28)

Thanks

by

- Enrico


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: mod_perl httpd doesn't start as DSO

2003-11-26 Thread BeerBong
> > Hello!
> >
> > I wanted to build a debian package of apache for my specific purposes.
> > My specific purpose is mod_accel support.
> > I downloaded a source for apache debian package (apache-1.3.26)
> > from stable distribution, add mod_accel patches and it
> > have been compiled well.
> [...]
> > Program received signal SIGABRT, Aborted.
> > [Switching to Thread 1024 (LWP 15551)]
> > 0x40107781 in kill () from /lib/libc.so.6
>
> As you can see from the trace if fails when loading your startup file. You
> want to find the offensive line that triggers this failure. One way to do
it
> is to go one frame up:
>
> > (gdb) where
> > #0  0x40107781 in kill () from /lib/libc.so.6
> > #1  0x40373cd3 in Perl_my_unexec () from /usr/lib/libperl.so.5.6
>
> (gdb) up
>
> and then ask perl where it was when the problem has happened.
>
> (gdb) printf "%d:%s\n", PL_curcop->cop_line,
>
((XPV*)(*(XPVGV*)PL_curcop->cop_filegv->sv_any)->xgv_gp->gp_sv->sv_any)->xpv
_pv
>
> This is with non-threaded perl, you didn't send the output of 'perl -V' as
you
> are being suggested to at http://perl.apache.org/bugs/, so in case your
perl
> is threaded, you will want to run:
>
> (gdb) printf "%d:%s\n", my_perl->Tcurcop->cop_line,
my_perl->Tcurcop->cop_file

Perl is not threaded...
---
Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
  Platform:
osname=linux, osvers=2.4.20-7um, archname=i386-linux
uname='linux (none) 2.4.20-7um #1 smp fri aug 8 18:30:28 edt 2003 i686
unknown '




config_args='-Dccflags=-DDEBIAN -Dcccdlflags=-fPIC -Darchname=i386-linux -Dp
refix=/usr -Dprivlib=/usr/share/perl/5.6.1 -Darchlib=/usr/lib/perl/5.6.1 -Dv
endorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5 -D
siteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.6.1 -Dsitearch=/usr/
local/lib/perl/5.6.1 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/
man3 -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_c
sh -Uusesfio -Duseshrplib -Dlibperl=libperl.so.5.6.1 -Dd_dosuid -des'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
  Compiler:
cc='cc', ccflags
='-DDEBIAN -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_
FILE_OFFSET_BITS=64',
optimize='-O2',
cppflags='-DDEBIAN -fno-strict-aliasing -I/usr/local/include'
ccversion='', gccversion='2.95.4 20011002 (Debian prerelease)',
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=8
alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lgdbm -ldb -ldl -lm -lc -lcrypt
perllibs=-ldl -lm -lc -lcrypt
libc=/lib/libc-2.2.5.so, so=so, useshrplib=true,
libperl=libperl.so.5.6.1
  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: USE_LARGE_FILES
  Built under linux
  Compiled at Aug 10 2003 01:06:01
  @INC:
/usr/local/lib/perl/5.6.1
/usr/local/share/perl/5.6.1
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.6.1
/usr/share/perl/5.6.1
/usr/local/lib/site_perl
.
---

But I have another problem :/

-
warzavod:/var/www/default/zentrack# gdb /usr/sbin/apache-power
GNU gdb 2002-04-01-cvs
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-linux"...
(gdb) set args -X -DPOWER
(gdb) run
Starting program: /usr/sbin/apache -X -DPOWER
perl_parse args: '/dev/null' ...allocating perl interpreter...ok
constructing perl interpreter...ok
PerlPassEnv: `ORACLE_HOME'=`/u01/app/oracle/product/8.1.7'
PerlPassEnv: `NLS_LANG'=`AMERICAN_AMERICA.CL8MSWIN1251'
PerlPassEnv:
`ORA_NLS'=`/u01/app/oracle/product/8.1.7/ocommon/nls/admin/data'
running perl interpreter...ok
mod_perl: 0 END blocks encountered during server startup
PerlRequire: arg=`startup.pl'
attempting to require `startup.pl'
loading perl module 'Apache::Constants::Exports'...ok
[New Thread 1024 (LWP 17423)]

Program received signal SIGABRT, Aborted.
[Switching to Thread 1024 (LWP 17423)]
0x40107781 in kill () from /lib/libc.so.6
(gdb) source ~alexei/forge/furnace/libapache-mod-perl-1.26/.gdbinit
(gdb) up
#1  0x40373cd3 in Perl_my_unexec () from /u

Re: [mp2] Apache::OK vs 200

2003-11-26 Thread Stas Bekman
I've documented the mod_perl 2.0 handler return value "protocol" here:
http://perl.apache.org/docs/2.0/user/handlers/intro.html#Handler_Return_Values
Please read and submit patches if something is wrong/unclear. Muchas Gracias.
__
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
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Caching CGI scripts running under Apache::Registry

2003-11-26 Thread Jean-Michel Hiver
Hi List,

At the moment my application runs as a mix of mod_perl handlers and a
rather large-ish Apache::Registry CGI program.

Initially the application was generating everything on the fly. Due to
performance issues, I started writing a little cache manager so that
most pages are cached, such as:

  http://mkdoc.com/
  http://mkdoc.com/news/newsletters/

However certain dynamic pages remain uncached, such as:

  http://mkdoc.com/.sitemap.html
  http://mkdoc.com/.print.html

What I need is a generic apache handler which would cache any HEAD and
GET methods for a configurable amount of time, and let the POST methods
through.

It would also need to be partly purgeable. For example, if an editor
goes to /foo/.properties.html and changes the title of /foo/, then /foo/
needs to be purged from the cache.

Is there an Apache handler I can use for this purpose?

If not, which approach would you take in order to write one? I've
contemplated the idea but I'm stuck with capturing Apache::Registry or
Apache::RegistryNG's output.

Cheers,
-- 
Building a better web - http://www.mkdoc.com/
-
Jean-Michel Hiver
[EMAIL PROTECTED]  - +44 (0)114 255 8097
Homepage: http://www.webmatrix.net/

-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



repost: mod_perl get method params with SSI

2003-11-26 Thread Igor

Reposting... since I unintentionally sent the previous message as html.
Thanks Stas Bekman for noticing.

---

Hello everybody.

I am calling an ssi-enabled html page and it has an
SSI request to a mod_perl script.

I am making a request to http://localhost/info.shtml?name=john&age=25&sex=m

Or something similar.

Now. How can I get the params passed to shtml from within mod_perl program ?

I tried the script bellow, but it only works when I call it directly and not when it's 
called from SSI.

I am using Apache/2.0.47 (Win32) mod_perl/1.99_12-dev Perl/v5.8.0 PHP/4.3.4 Server.

ssi and mod_perl is configured properly. I just can't get the params.

Thanks for your help.

my perl file is:

#!/usr/bin/perl

use strict;
use CGI;

my $cgi = new CGI;
my @params = $cgi->param();

# Start http header
print "Content-type: text/plain\n\n";

print @params;
print $cgi->param('name');


___
Join Excite! - http://www.excite.com
The most personalized portal on the Web!

-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: Perl 5.8.2 and @INC confusion

2003-11-26 Thread Andrew Sterling Hanenkamp
Thanks for the prompt reply.

Stas Bekman wrote:
You probably have a messed up perl install. Nuke completely 
/home/sterling/local/apache-1.3/lib/perl5 rebuild the new perl, rebuild 
mod_perl and it should all be fine.
I did this once actually. When I rebuilt mod_perl the second time, I did 
an rm -rf of the perl5 directory before building.

You probably still had the old files from the previous mod_perl build 
lingering in the 5.8.0 subdirs.
Since, your intuition is the same as mine, I'll keep slogging. Probably 
I've still got something 5.8.0ish lingering where it shouldn't, but 
since mod_perl was using a different set of include directories from 
Perl itself, I thought there might be something more sinister going on. 
(I think I may have forgotten to do a make clean in the mod_perl 
distribution directory after I did the first build, which might have 
caused some residual pollution.)

Thanks,
Sterling
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: make test fails- can't find My::child_init

2003-11-26 Thread John Saylor
hi

> John Saylor wrote:
> >when i run make test i keep getting errors like this:
> >
> >[Tue Nov 25 17:12:11 2003] [error] Can't locate My/child_init.pm in @INC
> >(@INC contains: /usr/lib/perl5/5.8.0/i686-linux /usr/lib/perl5/5.8.0
> >/usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
> >/usr/lib/perl5/site_perl/5.6.1 /usr/lib/perl5/site_perl
> >/usr/lib/perl5/vendor_perl/5.8.0/i686-linux
> >/usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .
> >/usr/local/src/mod_perl-1.29/t/ /usr/local/src/mod_perl-1.29/t/lib/perl) at
> >(eval 5) line 3.

> >now My::child_init is defined in t/docs/startup.pl but for some reason the
> >test script isn't seeing it there. any suggestions?

( 03.11.25 15:28 -0800 ) Stas Bekman:
> Show us a sample code.

it's all in the mod_perl tests. this is not my code at all! this is the
part where the webserver starts up before doing the mod_perl testing. i
give the command:
make test


and it fails like this:
cp t/conf/mod_perl_srm.conf t/conf/srm.conf
./apaci/load_modules.pl ../apache_1.3.29/src
../apache_1.3.29/src/httpd -f `pwd`/t/conf/httpd.conf -X -d `pwd`/t &
httpd listening on port 8529
will write error_log to: t/logs/error_log
letting apache warm up...\c
done
/usr/bin/perl t/TEST 0
still waiting for server to warm up...not ok
server failed to start! (please examine t/logs/error_log) at t/TEST line 95.
make: *** [run_tests] Error 111


so the error log reference is the one i've included earlier in this
mail.

in the t/conf/httpd.conf there's this:
PerlChildInitHandler My::child_init
PerlChildExitHandler My::child_exit


and in t/docs/startup.pl i've found this:
#testing child init/exit hooks

sub My::child_init {
my $r = shift;
eval {
  my $s = $r->server;
  my $sa = $s->server_admin;
  $s->warn("[notice] child_init for process $$, report any problems to $sa\n");
}; [EMAIL PROTECTED]'' if $@;
0;
}


in the mod_perl-1.29 directory. here are the arguments i'm passing to
perl Makefile.PL

APACHE_SRC=../apache_1.3.29/src DO_HTTPD=1 USE_APACI=1 PREP_HTTPD=1 USE_DSO=1 
PERL_TRACE=1 PERL_DEBUG=1 PERL_SSI=0 EVERYTHING=1


thanks for any help.

-- 
\js "don't panic"


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Updating "constant" datastructures in MP2

2003-11-26 Thread Elizabeth Mattijsen
I was wondering whether the following trick could somehow work with 
mod_perl 2.  And excuse my preference for prefork MPM's: I guess 
that's the hammer to work on all my nails (pun intended).  I'm open 
to other solutions to this "problem"!

The problem:
-
When you're using prefork MPM, you try to create as many constant 
data-structures as possible before the children are being forked. 
Sometimes, these structures require updating during the lifetime of 
the server, but the updated information does not need to be available 
to all the currently running children.  And/Or you don't want the 
server to be completely restarted for that.  An example would be a 
blacklist of IP-numbers that you want to block, or indexes that only 
need updating if a new entry is added.

Note that the Perl code remains unchanged, it's just some 
data-structures (usually hashes and lists) that you want updated and 
distributed among newly created children.

The idea I has was this:

at compile time, a signal handler is installed:

package Foo
our updatedat = 0;
$SIG{123} = sub { $updatedat = time() };
and a Perl*Handler (PreConnection?) is installed.  This handler 
should run _inside_ the parent before each request.  It would 
conceptually go like this:

sub Foo::check_update {

return unless my $at = $updatedat; # return now unless something 
needs to be updated
# update data-structures
$updatedat = 0 if $updatedat == $at; # only reset flag if not set 
again in different second
}

Then:

any process, and this could be one of the Apache children, sends a 
signal 123 to the parent Apache process because it has updated the 
external copy of the data structure (e.g. it has added an IP number 
to the blacklist).  When a new request comes in, the flag is checked 
and the internal data-structure is updated.  And all new children 
after that, will automatically get this new, shared data.

Would this make sense in a prefork MPM (in a *nix environment, of course)?

Or are there better solutions to this "problem" ?

Liz

--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Caching CGI scripts running under Apache::Registry

2003-11-26 Thread Paul Lindner
On Wed, Nov 26, 2003 at 11:40:19AM +, Jean-Michel Hiver wrote:
> Hi List,
> 
> At the moment my application runs as a mix of mod_perl handlers and a
> rather large-ish Apache::Registry CGI program.
> 
> Initially the application was generating everything on the fly. Due to
> performance issues, I started writing a little cache manager so that
> most pages are cached, such as:
> 
>   http://mkdoc.com/
>   http://mkdoc.com/news/newsletters/
> 
> However certain dynamic pages remain uncached, such as:
> 
>   http://mkdoc.com/.sitemap.html
>   http://mkdoc.com/.print.html
> 
> What I need is a generic apache handler which would cache any HEAD and
> GET methods for a configurable amount of time, and let the POST methods
> through.
> 
> It would also need to be partly purgeable. For example, if an editor
> goes to /foo/.properties.html and changes the title of /foo/, then /foo/
> needs to be purged from the cache.
> 
> Is there an Apache handler I can use for this purpose?
> 
> If not, which approach would you take in order to write one? I've
> contemplated the idea but I'm stuck with capturing Apache::Registry or
> Apache::RegistryNG's output.

If you're willing to enter the wild-n-wooly world of object-oriented
mod_perl handlers you might consider trying Apache::CacheContent
(available on CPAN), which is based on Cookbook::CacheContent in the
mod_perl Developer's Cookbook.

It dumps the request onto a file on disk based on the URL.  If the
file is removed then the content is regenerated.  The module does not
cache headers, instead it uses Apache's built-in file-serving code to
serve up cached content written to disk.

Give it a try...  OO handlers are quite fun.

-- 
Paul Lindner[EMAIL PROTECTED]   | | | | |  |  |  |   |   |

mod_perl Developer's Cookbook   http://www.modperlcookbook.org/
 Human Rights Declaration   http://www.unhchr.ch/udhr/

-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: mod_perl httpd doesn't start as DSO

2003-11-26 Thread BeerBong
> Program received signal SIGABRT, Aborted.
> [Switching to Thread 1024 (LWP 17423)]
> 0x40107781 in kill () from /lib/libc.so.6
> (gdb) source ~alexei/forge/furnace/libapache-mod-perl-1.26/.gdbinit
> (gdb) up
> #1  0x40373cd3 in Perl_my_unexec () from /usr/lib/libperl.so.5.6
> (gdb) curinfo
> Attempt to extract a component of a value that is not a structure pointer.

warzavod:~# perl -V:archlibexp
archlibexp='/usr/lib/perl/5.6.1';
warzavod:~# ls /usr/lib/perl/5.6.1/CORE/libperld.a
/usr/lib/perl/5.6.1/CORE/libperld.a

I rebuild mod_perl with PERL_DEBUG=1, restart process:
--
gdb /usr/sbin/apache
...
--
But result the same :(
--
Attempt to extract a component of a value that is not a structure pointer.
--

But...
I found a line in startup.pl, which brokes Apache:
use DBD::Oracle

I don't know why, but simple scripts on this machine kinda
--
use strict;
use DBI;

$ENV{ORACLE_HOME} = "/u01/app/oracle/product/8.1.7";
$ENV{NLS_LANG} = "AMERICAN_AMERICA.CL8MSWIN1251";

my $dbh = DBI->connect('DBI:Oracle:SIMain', '', '');
my $news = $dbh->selectrow_array("select count(*) from portal.contents");
print "$news\n";
$dbh->disconnect;
--
works fine...

:-/
--
Sergey Polyakov aka BeerBong
Chief of WebZavod http://www.webzavod.ru
Tel. +7 (8462) 43-93-85 | +7 (8462) 43-93-86
  mailto:[EMAIL PROTECTED]



-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



RE: authentication with smb

2003-11-26 Thread Tauber, Mathias HDP
> 1. Updated Authen::Smb with this:
> 
> use Fcntl qw(:flock);
> ...
> open S, "> /full/path/to/AuthenSmb.lck" or
> die "Can't open AuthenSmb.lck: $!\n";
> flock S, LOCK_EX;
> my $res = Valid_User($username, $password, $server, $backup, $domain);
> close S;

I was given this solution, to fix the problem with
multiple authentication requests.

I have implemented flocking and now it's running
without problems. Because it needs to be very
secure, I just wanted to ask how this is working!

Isn't this solution unsecure, if somebody is doing
a kind of DOS attack?

I asked a few weeks ago, how secure this solutions
is, but nobody has given me an answer. Maybe this
time


-Mathias-

-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Unable to install mod_perl using several tutorials...

2003-11-26 Thread Jonathan Villa
Ok, I'm trying to install OpenWebMail but I keep getting an Internal 
Server Error when I try to access it via the web.

Here is what I have/did

Installed: Apache 1.3.29/mod_ssl 2.8.16-1.3.29/PHP 4.3.4
Installed: v5.8.2 built for i686-linux
I'm trying to install mod_perl 1.29 and I've followed several tutorials, 
many of which compile apache with mod_perl and seem to mess up my httpd 
configuration.  So, what I'm trying to do is to get mod_perl working but 
without having to recompile Apache.  Perhaps I already have it installed 
since this is in my httpd.conf file

LoadModule perl_modulelibexec/libperl.so
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

AllowOverride None
Options None
Order allow,deny
Allow from all

and libperl.so is indeed in the libexec dir.

Anyway, perl seems to be working because I tried ./openwebmail-tool.pl 
and it works, and if I do a perl -V I get information.

So, I tried this:

I created a file, index.pl, inside of /var/www/cgi-bin and all it has is

#!/usr/bin/perl
print "does this work\n";
via command line

$perl index.pl
does this work
but via the web, I get an Internal Server Error
and in the error_log
Premature end of script headers: /var/www/cgi-bin/index.pl



I'm very perplexed

--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Unable to install mod_perl using several tutorials...

2003-11-26 Thread tvilliers
On Wed, 26 Nov 2003 09:36:39 -0600, Jonathan Villa wrote:

> Ok, I'm trying to install OpenWebMail but I keep getting an Internal
> Server Error when I try to access it via the web.
> 
> Here is what I have/did
> 
> Installed: Apache 1.3.29/mod_ssl 2.8.16-1.3.29/PHP 4.3.4 Installed: v5.8.2
> built for i686-linux
> 
> I'm trying to install mod_perl 1.29 and I've followed several tutorials,
> many of which compile apache with mod_perl and seem to mess up my httpd
> configuration.  So, what I'm trying to do is to get mod_perl working but
> without having to recompile Apache.  Perhaps I already have it installed
> since this is in my httpd.conf file
> 
> LoadModule perl_modulelibexec/libperl.so ScriptAlias /cgi-bin/
> "/var/www/cgi-bin/" 
>  AllowOverride None
>  Options None
>  Order allow,deny
>   Allow from all
> 
> 
> and libperl.so is indeed in the libexec dir.
> 
> Anyway, perl seems to be working because I tried ./openwebmail-tool.pl and
> it works, and if I do a perl -V I get information.
> 
> So, I tried this:
> 
> I created a file, index.pl, inside of /var/www/cgi-bin and all it has is
> 
> #!/usr/bin/perl
> print "does this work\n";
> 
> via command line
> 
> $perl index.pl
> does this work
> 
> but via the web, I get an Internal Server Error and in the error_log
> 
> Premature end of script headers: /var/www/cgi-bin/index.pl
> 
> 

print "Content-type:text/html\n\n"

before anything else to avoid this error

> 
> I'm very perplexed

Openwebmail does not require a mod_perl httpd, but the latest version (6
weeks ago) does require a suidperl. The initial setup can be a bit
daunting, but it's well worth it.




-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: Unable to install mod_perl using several tutorials...

2003-11-26 Thread Jonathan Villa
I did the Content-Type and nothing new...

So you're saying that Openwebmail does not require mod_perl?  This is 
the main thing I need to get setup...so perhaps I should look into the 
openwebmail forum for a solution?

The only thing that confuses me is how does a web based program work 
without mod_perl?

And how can I get the simple index.pl file to work, I think I would feel 
more comfortable once that is working...

tvilliers wrote:

On Wed, 26 Nov 2003 09:36:39 -0600, Jonathan Villa wrote:


Ok, I'm trying to install OpenWebMail but I keep getting an Internal
Server Error when I try to access it via the web.
Here is what I have/did

Installed: Apache 1.3.29/mod_ssl 2.8.16-1.3.29/PHP 4.3.4 Installed: v5.8.2
built for i686-linux
I'm trying to install mod_perl 1.29 and I've followed several tutorials,
many of which compile apache with mod_perl and seem to mess up my httpd
configuration.  So, what I'm trying to do is to get mod_perl working but
without having to recompile Apache.  Perhaps I already have it installed
since this is in my httpd.conf file
LoadModule perl_modulelibexec/libperl.so ScriptAlias /cgi-bin/
"/var/www/cgi-bin/" 
AllowOverride None
Options None
Order allow,deny
Allow from all

and libperl.so is indeed in the libexec dir.

Anyway, perl seems to be working because I tried ./openwebmail-tool.pl and
it works, and if I do a perl -V I get information.
So, I tried this:

I created a file, index.pl, inside of /var/www/cgi-bin and all it has is

#!/usr/bin/perl
print "does this work\n";
via command line

$perl index.pl
does this work
but via the web, I get an Internal Server Error and in the error_log

Premature end of script headers: /var/www/cgi-bin/index.pl




print "Content-type:text/html\n\n"

before anything else to avoid this error


I'm very perplexed


Openwebmail does not require a mod_perl httpd, but the latest version (6
weeks ago) does require a suidperl. The initial setup can be a bit
daunting, but it's well worth it.





--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Unable to install mod_perl using several tutorials...

2003-11-26 Thread Jonathan Villa
I even tried a simple index.html within the /var/www/cgi-bin dir...

FYI, I do have suidperl installed

Jonathan Villa wrote:

I did the Content-Type and nothing new...

So you're saying that Openwebmail does not require mod_perl?  This is 
the main thing I need to get setup...so perhaps I should look into the 
openwebmail forum for a solution?

The only thing that confuses me is how does a web based program work 
without mod_perl?

And how can I get the simple index.pl file to work, I think I would feel 
more comfortable once that is working...

tvilliers wrote:

On Wed, 26 Nov 2003 09:36:39 -0600, Jonathan Villa wrote:


Ok, I'm trying to install OpenWebMail but I keep getting an Internal
Server Error when I try to access it via the web.
Here is what I have/did

Installed: Apache 1.3.29/mod_ssl 2.8.16-1.3.29/PHP 4.3.4 Installed: 
v5.8.2
built for i686-linux

I'm trying to install mod_perl 1.29 and I've followed several tutorials,
many of which compile apache with mod_perl and seem to mess up my httpd
configuration.  So, what I'm trying to do is to get mod_perl working but
without having to recompile Apache.  Perhaps I already have it installed
since this is in my httpd.conf file
LoadModule perl_modulelibexec/libperl.so ScriptAlias /cgi-bin/
"/var/www/cgi-bin/" 
AllowOverride None
Options None
Order allow,deny
Allow from all

and libperl.so is indeed in the libexec dir.

Anyway, perl seems to be working because I tried 
./openwebmail-tool.pl and
it works, and if I do a perl -V I get information.

So, I tried this:

I created a file, index.pl, inside of /var/www/cgi-bin and all it has is

#!/usr/bin/perl
print "does this work\n";
via command line

$perl index.pl
does this work
but via the web, I get an Internal Server Error and in the error_log

Premature end of script headers: /var/www/cgi-bin/index.pl




print "Content-type:text/html\n\n"

before anything else to avoid this error


I'm very perplexed


Openwebmail does not require a mod_perl httpd, but the latest version (6
weeks ago) does require a suidperl. The initial setup can be a bit
daunting, but it's well worth it.







--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Unable to install mod_perl using several tutorials...

2003-11-26 Thread Jonathan Villa
Sorry for the repeats

I noticed that on the top of the pages, there is

#!/usr/bin/suidperl -T

so I tried that on the command line and get this:

Script is not setuid/setgid in suidperl

???

Jonathan Villa wrote:

I did the Content-Type and nothing new...

So you're saying that Openwebmail does not require mod_perl?  This is 
the main thing I need to get setup...so perhaps I should look into the 
openwebmail forum for a solution?

The only thing that confuses me is how does a web based program work 
without mod_perl?

And how can I get the simple index.pl file to work, I think I would feel 
more comfortable once that is working...

tvilliers wrote:

On Wed, 26 Nov 2003 09:36:39 -0600, Jonathan Villa wrote:


Ok, I'm trying to install OpenWebMail but I keep getting an Internal
Server Error when I try to access it via the web.
Here is what I have/did

Installed: Apache 1.3.29/mod_ssl 2.8.16-1.3.29/PHP 4.3.4 Installed: 
v5.8.2
built for i686-linux

I'm trying to install mod_perl 1.29 and I've followed several tutorials,
many of which compile apache with mod_perl and seem to mess up my httpd
configuration.  So, what I'm trying to do is to get mod_perl working but
without having to recompile Apache.  Perhaps I already have it installed
since this is in my httpd.conf file
LoadModule perl_modulelibexec/libperl.so ScriptAlias /cgi-bin/
"/var/www/cgi-bin/" 
AllowOverride None
Options None
Order allow,deny
Allow from all

and libperl.so is indeed in the libexec dir.

Anyway, perl seems to be working because I tried 
./openwebmail-tool.pl and
it works, and if I do a perl -V I get information.

So, I tried this:

I created a file, index.pl, inside of /var/www/cgi-bin and all it has is

#!/usr/bin/perl
print "does this work\n";
via command line

$perl index.pl
does this work
but via the web, I get an Internal Server Error and in the error_log

Premature end of script headers: /var/www/cgi-bin/index.pl




print "Content-type:text/html\n\n"

before anything else to avoid this error


I'm very perplexed


Openwebmail does not require a mod_perl httpd, but the latest version (6
weeks ago) does require a suidperl. The initial setup can be a bit
daunting, but it's well worth it.







--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Unable to install mod_perl using several tutorials...

2003-11-26 Thread Chris Grau
On Wed, Nov 26, 2003 at 10:41:56AM -0600, Jonathan Villa wrote:
> Sorry for the repeats
> 
> I noticed that on the top of the pages, there is
> 
> #!/usr/bin/suidperl -T
> 
> so I tried that on the command line and get this:
> 
> Script is not setuid/setgid in suidperl

I'm not familiar with suidperl, but could that error mean that you need
to set the setuid bit on the script?

chmod u+s /path/to/script.pl

Of course, there are the usual security caveats.  I don't know what
user/group you plan on using with these scripts.

-chris


pgp0.pgp
Description: PGP signature


MIME::Lite and Excel

2003-11-26 Thread ero
Hey all,

   I am trying to get MIME::Lite to attach an Excel spreadsheet created via
Spreadsheet::WriteExcel to an outgoing email and something is not working
quite right.

   Here's the code:

my $mail = MIME::Lite->new(
 From   =>'[EMAIL PROTECTED]',
 To =>'[EMAIL PROTECTED]',
 Subject=>"New Report",
 Type   =>'multipart/mixed',
 Data   => $stuff,
);
 $mail->attach( 
Type=>'application/vnd.ms-excel',
FH  => $file,
Filename=> $workbook,
ReadNow => 1,
Disposition => 'attachment',
  );
 $mail->send || warn "mail attempt failed: $@";

All documentation and forums that I have Googled has said this is the way
to do this. But I get an error like this:

binmode() on unopened filehandle at usr/lib/perl5/site_perl/5.8.0/MIME/Lite.pm
line 1816.
read() on unopened filehandle at /usr/lib/perl5/site_perl/5.8.0/MIME/Lite.pm
line 1817.

What exactly is going wrong here? Thanks in advance for any pointers and
by the way, this is my first question to the list... 

Eric











-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: MIME::Lite and Excel

2003-11-26 Thread Chris Grau
On Wed, Nov 26, 2003 at 04:54:08PM -, [EMAIL PROTECTED] wrote:
> Hey all,
> 
>I am trying to get MIME::Lite to attach an Excel spreadsheet created via
> Spreadsheet::WriteExcel to an outgoing email and something is not working
> quite right.
[snip]

This doesn't appear to have anything to do with mod_perl.  You will
probably have better luck finding answers on Perl Monks or on another
Perl list (http://lists.cpan.org/).

-chris


pgp0.pgp
Description: PGP signature


Re: MIME::Lite and Excel

2003-11-26 Thread Sven Geisler
Hi Eric,

Did you try Path instead of FH?

Sven.


Am Mit, 2003-11-26 um 17.54 schrieb [EMAIL PROTECTED]:
> Hey all,
> 
>I am trying to get MIME::Lite to attach an Excel spreadsheet created via
> Spreadsheet::WriteExcel to an outgoing email and something is not working
> quite right.
> 
>Here's the code:
> 
> my $mail = MIME::Lite->new(
>  From   =>'[EMAIL PROTECTED]',
>  To =>'[EMAIL PROTECTED]',
>  Subject=>"New Report",
>  Type   =>'multipart/mixed',
>  Data   => $stuff,
> );
>  $mail->attach( 
> Type=>'application/vnd.ms-excel',
> FH  => $file,
> Filename=> $workbook,
> ReadNow => 1,
> Disposition => 'attachment',
>   );
>  $mail->send || warn "mail attempt failed: $@";
> 
> All documentation and forums that I have Googled has said this is the way
> to do this. But I get an error like this:
> 
> binmode() on unopened filehandle at usr/lib/perl5/site_perl/5.8.0/MIME/Lite.pm
> line 1816.
> read() on unopened filehandle at /usr/lib/perl5/site_perl/5.8.0/MIME/Lite.pm
> line 1817.
> 
> What exactly is going wrong here? Thanks in advance for any pointers and
> by the way, this is my first question to the list... 
> 
> Eric
> 
> 
> 
> 
> 
> 
> 
> 
-- 
Sven Geisler <[EMAIL PROTECTED]>
AEC/communications GmbH


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: Caching CGI scripts running under Apache::Registry

2003-11-26 Thread Randal L. Schwartz
> "Jean-Michel" == Jean-Michel Hiver <[EMAIL PROTECTED]> writes:

Jean-Michel> However certain dynamic pages remain uncached, such as:

Jean-Michel>   http://mkdoc.com/.sitemap.html
Jean-Michel>   http://mkdoc.com/.print.html

Jean-Michel> What I need is a generic apache handler which would cache any HEAD and
Jean-Michel> GET methods for a configurable amount of time, and let the POST methods
Jean-Michel> through.

Generally, about the time you get to caching, you also want a split
server.  I'm successfully using a thin-caching-front,
thick-mod_perl-back split server, where both docroots point at the
same tree.  The advantage is that I can quickly decide that something
can be served entirely from the front.  I can also implement various
caching policies in the back with mod_expires.  It's quite sweet.

By the way, these are both running on the same box, and I still see
serious advantages.

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

-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: Unable to install mod_perl using several tutorials...

2003-11-26 Thread Jonathan Villa
Ok, I should have read the FAQ for Openwebmail first... which says that 
openwebmail cannot be used with mod_perl... that would have saved me 
some time in thinking that perhaps it was because of mod_perl and 
joining this list...

thanks for at least reading this...

Jonathan Villa wrote:

Sorry for the repeats

I noticed that on the top of the pages, there is

#!/usr/bin/suidperl -T

so I tried that on the command line and get this:

Script is not setuid/setgid in suidperl

???

Jonathan Villa wrote:

I did the Content-Type and nothing new...

So you're saying that Openwebmail does not require mod_perl?  This is 
the main thing I need to get setup...so perhaps I should look into the 
openwebmail forum for a solution?

The only thing that confuses me is how does a web based program work 
without mod_perl?

And how can I get the simple index.pl file to work, I think I would 
feel more comfortable once that is working...

tvilliers wrote:

On Wed, 26 Nov 2003 09:36:39 -0600, Jonathan Villa wrote:


Ok, I'm trying to install OpenWebMail but I keep getting an Internal
Server Error when I try to access it via the web.
Here is what I have/did

Installed: Apache 1.3.29/mod_ssl 2.8.16-1.3.29/PHP 4.3.4 Installed: 
v5.8.2
built for i686-linux

I'm trying to install mod_perl 1.29 and I've followed several 
tutorials,
many of which compile apache with mod_perl and seem to mess up my httpd
configuration.  So, what I'm trying to do is to get mod_perl working 
but
without having to recompile Apache.  Perhaps I already have it 
installed
since this is in my httpd.conf file

LoadModule perl_modulelibexec/libperl.so ScriptAlias /cgi-bin/
"/var/www/cgi-bin/" 
AllowOverride None
Options None
Order allow,deny
Allow from all

and libperl.so is indeed in the libexec dir.

Anyway, perl seems to be working because I tried 
./openwebmail-tool.pl and
it works, and if I do a perl -V I get information.

So, I tried this:

I created a file, index.pl, inside of /var/www/cgi-bin and all it 
has is

#!/usr/bin/perl
print "does this work\n";
via command line

$perl index.pl
does this work
but via the web, I get an Internal Server Error and in the error_log

Premature end of script headers: /var/www/cgi-bin/index.pl






print "Content-type:text/html\n\n"

before anything else to avoid this error


I'm very perplexed




Openwebmail does not require a mod_perl httpd, but the latest version (6
weeks ago) does require a suidperl. The initial setup can be a bit
daunting, but it's well worth it.









--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Caching CGI scripts running under Apache::Registry

2003-11-26 Thread Jean-Michel Hiver
> If you're willing to enter the wild-n-wooly world of object-oriented
> mod_perl handlers you might consider trying Apache::CacheContent
> (available on CPAN), which is based on Cookbook::CacheContent in the
> mod_perl Developer's Cookbook.

Aha! Cheers for this. I've made /some/ progress, but it's still not quite
there...


> It dumps the request onto a file on disk based on the URL.  If the
> file is removed then the content is regenerated.  The module does not
> cache headers, instead it uses Apache's built-in file-serving code to
> serve up cached content written to disk.

That's not what I need though =) Currently what I want to cache is a CGI script
which uses a combination of PATH_INFO and sometimes QUERY_STRING.

So that the site looks like (for the most part) a static site, I use the
following trick in my httpd.conf:

  Alias /   /opt/mkd/cgi/mkdoc.cgi/

  
# directives for mod_perl
PerlSetEnv PERL5LIB /opt/mkd
SetHandler perl-script
PerlHandler Apache::RegistryNG
PerlSendHeader On

# directives for CGI.
Options +ExecCGI
AddHandler cgi-script .cgi
order allow,deny
allow from all
AllowOverride none
  

So as you can see, I would need to cache the HEAD and GET methods going to the
mkdoc.cgi script, which is running under Apache::Registry.

Thanks to your pointers, I've managed to write a subclass of Apache::RegistryNG
which captures what would have been the output of Apache::RegistryNG and writes
it into '/tmp/foo'. (Attached file).

However, I cannot get this same module to actually send correctly the captured
output... Have you got any suggestions?

Thanks a bunch,
-- 
Building a better web - http://www.mkdoc.com/
-
Jean-Michel Hiver
[EMAIL PROTECTED]  - +44 (0)114 255 8097
Homepage: http://www.webmatrix.net/


Cache.pm
Description: Perl program
-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html

Re: mod_perl httpd doesn't start as DSO

2003-11-26 Thread Stas Bekman
BeerBong wrote:
Program received signal SIGABRT, Aborted.
[Switching to Thread 1024 (LWP 17423)]
0x40107781 in kill () from /lib/libc.so.6
(gdb) source ~alexei/forge/furnace/libapache-mod-perl-1.26/.gdbinit
(gdb) up
#1  0x40373cd3 in Perl_my_unexec () from /usr/lib/libperl.so.5.6
(gdb) curinfo
Attempt to extract a component of a value that is not a structure pointer.
I guess, that macro was written for 5.005 and things have changed in 5.6. I 
haven't been debugging with 5.6 for a long time. It's certainly different 
under 5.8. I had to change a lot of things in .gdbinit, but never had a chance 
to polish it.

But...
I found a line in startup.pl, which brokes Apache:
use DBD::Oracle
I don't know why, but simple scripts on this machine kinda
--
use strict;
use DBI;
$ENV{ORACLE_HOME} = "/u01/app/oracle/product/8.1.7";
$ENV{NLS_LANG} = "AMERICAN_AMERICA.CL8MSWIN1251";
my $dbh = DBI->connect('DBI:Oracle:SIMain', '', '');
my $news = $dbh->selectrow_array("select count(*) from portal.contents");
print "$news\n";
$dbh->disconnect;
--
works fine...
But you don't load DBD::Oracle explicitly here, as you do in the startup.pl. 
Any difference if you omit 'use DBD::Oracle' and just keep 'use DBI'?

__
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
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: PerlSetVar with '0' value

2003-11-26 Thread Stas Bekman
Enrico Sorcinelli wrote:
[...]
Index: src/modules/perl/Apache.xs
[...]
-if (!SvTRUE(RETVAL)) {
+if (!SvOK(RETVAL)) {
[...]
Hi Geoff,
the patch seems to work fine.
I've applied it over mp 1.29 (with Apache 1.3.28)
Since this is a bug, fixing it is a right thing to do. If someone was relying 
on the bug and didn't tell us that there was a bug, too bad for them. It's not 
like we are breaking API with this fix.

__
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
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


RE: MIME::Lite and Excel

2003-11-26 Thread Goehring, Chuck Mr., RCI - San Diego

Eric
I arrived at this method (works under mod_perl)to send images as attachements:


  $msg = build MIME::Lite From => $aApobj->getEmail_Address,
  To  => $recip, Subject => $Sub,
  Type => 'TEXT', Data => $lPB;

  $OpStatus .= "Recipient: $recip.";
  if($aReceipt ne '') {  # If return reciept requested.
$msg->add("Disposition-Notification-To"=> $aApobj->getEmail_Address);  
  }
  if(0==0) { # Production mode.
attach $msg
  Type => 'image/save_as_tiff',
  Encoding => 'base64',
  Path => $TempFileName,
  Filename => $NewDocName; 
  }

Had to make a bogus type to get it to work right.  Don't know why I have "build" in 
there.

Chuck

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 26, 2003 8:54 AM
To: [EMAIL PROTECTED]
Subject: MIME::Lite and Excel


Hey all,

   I am trying to get MIME::Lite to attach an Excel spreadsheet created via
Spreadsheet::WriteExcel to an outgoing email and something is not working
quite right.

   Here's the code:

my $mail = MIME::Lite->new(
 From   =>'[EMAIL PROTECTED]',
 To =>'[EMAIL PROTECTED]',
 Subject=>"New Report",
 Type   =>'multipart/mixed',
 Data   => $stuff,
);
 $mail->attach( 
Type=>'application/vnd.ms-excel',
FH  => $file,
Filename=> $workbook,
ReadNow => 1,
Disposition => 'attachment',
  );
 $mail->send || warn "mail attempt failed: $@";

All documentation and forums that I have Googled has said this is the way
to do this. But I get an error like this:

binmode() on unopened filehandle at usr/lib/perl5/site_perl/5.8.0/MIME/Lite.pm
line 1816.
read() on unopened filehandle at /usr/lib/perl5/site_perl/5.8.0/MIME/Lite.pm
line 1817.

What exactly is going wrong here? Thanks in advance for any pointers and
by the way, this is my first question to the list... 

Eric











-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



[admin] please trim quoted text in your replies!

2003-11-26 Thread Stas Bekman
Jonathan and others, please quote only the relevant context you are replying 
to. If you have to do the awful reply-on-top, just delete the whole quoted 
text, we already have the original messages to find the context, and the 
quoting at the bottom is unusable anyway.

May I suggest that when you post questions to any open source projects you 
will get a much better treatment if you use better email practices?
You may want to spend some time reading the guidelines of this list:
http://perl.apache.org/maillist/email-etiquette.html

Thank you.

__
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
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Unable to install mod_perl using several tutorials...

2003-11-26 Thread Stas Bekman
tvilliers wrote:
[...]
but via the web, I get an Internal Server Error and in the error_log

Premature end of script headers: /var/www/cgi-bin/index.pl

print "Content-type:text/html\n\n"
; and " " are missing. Should be:

print "Content-type: text/html\n\n";

__
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
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: make test fails- can't find My::child_init

2003-11-26 Thread Stas Bekman
John Saylor wrote:

when i run make test i keep getting errors like this:

[Tue Nov 25 17:12:11 2003] [error] Can't locate My/child_init.pm in @INC
[...]
it's all in the mod_perl tests. this is not my code at all! this is the
part where the webserver starts up before doing the mod_perl testing. i
give the command:
make test
Aha! Sorry for missing this point. Any luck with this patch?

Index: t/docs/startup.pl
===
RCS file: /home/cvs/modperl/t/docs/startup.pl,v
retrieving revision 1.44
diff -u -r1.44 startup.pl
--- t/docs/startup.pl   23 May 2002 03:07:27 -  1.44
+++ t/docs/startup.pl   26 Nov 2003 18:41:25 -
@@ -142,7 +142,7 @@
 @MyClass::ISA = qw(BaseClass);
 #testing child init/exit hooks
-
+$INC{"My.pm"} = __FILE__;
 sub My::child_init {
 my $r = shift;
 eval {
__
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
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Updating "constant" datastructures in MP2

2003-11-26 Thread Stas Bekman
Elizabeth Mattijsen wrote:
I was wondering whether the following trick could somehow work with 
mod_perl 2.  And excuse my preference for prefork MPM's: I guess that's 
the hammer to work on all my nails (pun intended).  I'm open to other 
solutions to this "problem"!
Liz, when you are talking about prefork mpm, you get a better chance to get 
more people to read your question if you don't mention mp2. My guess is that 
folks won't even try to reply, since they aren't familiar with mp2. But your 
question applies to mp1 just as well.

The problem:
-
When you're using prefork MPM, you try to create as many constant 
data-structures as possible before the children are being forked. 
Sometimes, these structures require updating during the lifetime of the 
server, but the updated information does not need to be available to all 
the currently running children.  And/Or you don't want the server to be 
completely restarted for that.  An example would be a blacklist of 
IP-numbers that you want to block, or indexes that only need updating if 
a new entry is added.
If I remember correctly, you mentioned this to me back at YAPC::Paris in July. 
But back then you said you are going to gracefully restart the child 
processes, after updating the parent's data so that the newly spawned 
processes will see the updated info. It won't work in any other way.

You are probably much better off using a dbm file or some other external 
cache, so that you don't need to look for tricky solutions. David Harris wrote 
Apache::DB_File which is optimized for read-often/update-rarely case.

and a Perl*Handler (PreConnection?) is installed.  This handler should 
run _inside_ the parent before each request.  It would conceptually go 
like this:
PreConnection will work only if you don't use KeepAlive. With KeepAlive it'll 
be executed once for the whole connection. If you are talking about serving 
HTTP, you probably want PerlInitHandler. Similar to 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
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


qpsmtpd Was: Re: mod_perl smtp server

2003-11-26 Thread C. Jon Larsen

> qpsmtpd - http://develooper.com/code/qpsmtpd/ - is written in a way
> so it should be possible to make it run under mod_perl.
> 
>  - ask

I was considering using qpsmtpd to front end a sendmail-driven MailScanner 
box that gets about 30K messages per day. The thought was that qpsmtpd 
would be safer to expose to the world compared to sendmail. Any thoughts 
on this ? The qpsmtpd would query my databases via DBI and reject 
email for invalid recipients, lessening the load of bounces for forged 
spam, etc.

Anyone else using qpsmtpd like this ? There was a review in the Linux 
Journal just last month on it that spoke highly of it, but that seemed 
targeted at an end user or smallish server.

TIA,

-jon

-- 
+ Jon Larsen: Chief Technology Officer, Richweb, Inc.
+ Richweb.com: Providing Internet-Based Business Solutions since 1995
+ GnuPG Public Key: http://richweb.com/jlarsen.gpg
+ Business: (804) 359.2220 x 101; Mobile: (804) 307.6939


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: repost: mod_perl get method params with SSI

2003-11-26 Thread Stas Bekman
Igor wrote:

I am calling an ssi-enabled html page and it has an
SSI request to a mod_perl script.
I am making a request to http://localhost/info.shtml?name=john&age=25&sex=m

Or something similar.

Now. How can I get the params passed to shtml from within mod_perl program ?

I tried the script bellow, but it only works when I call it directly and not when it's called from SSI.

I am using Apache/2.0.47 (Win32) mod_perl/1.99_12-dev Perl/v5.8.0 PHP/4.3.4 Server.

ssi and mod_perl is configured properly. I just can't get the params.
You don't show us what your info.shtml does to call the mod_perl program, but 
I'd guess that it does:


So this is a sub-request, and you want to get the args from the main request, 
therefore you either need to retrieve them from the main request, e.g.:

#!/usr/bin/perl

use strict;

# remember that registy adds the sub wrapper
# sub handler {
my $r = shift;
unless ($r->is_main) {
my $main_args = $r->main->args;
$main_args = '' unless defined $main_args;
# reinstall main request's args into the subreq
$r->args($main_args);
}
then the rest of your script as before.

or you can change your shtml file to forward the args:


or my be this will work just fine:

See:
http://httpd.apache.org/docs-2.0/mod/mod_include.html#includevars
Neither of the above two has been tested. So it'd be nice if you reported back 
whether the two worked for you.

__
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
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: qpsmtpd Was: Re: mod_perl smtp server

2003-11-26 Thread Stas Bekman
C. Jon Larsen wrote:
qpsmtpd - http://develooper.com/code/qpsmtpd/ - is written in a way
so it should be possible to make it run under mod_perl.
- ask


I was considering using qpsmtpd to front end a sendmail-driven MailScanner 
box that gets about 30K messages per day. The thought was that qpsmtpd 
would be safer to expose to the world compared to sendmail. Any thoughts 
on this ? The qpsmtpd would query my databases via DBI and reject 
email for invalid recipients, lessening the load of bounces for forged 
spam, etc.

Anyone else using qpsmtpd like this ? There was a review in the Linux 
Journal just last month on it that spoke highly of it, but that seemed 
targeted at an end user or smallish server.
Please, let's not start discussing the benefits of sendmail vs. some other 
mail server without having any relation to mod_perl on this list. Talking 
about integrating a mail server with mod_perl is on-topic, but a general mail 
server talk is a way off-topic here.

Sorry for building walls here, but we want to keep this list focused on 
mod_perl and not drive users interested in mod_perl away.

I'd think that you want to ask your question at the scalable list, where you'd 
get the right answers. Please see:
http://perl.apache.org/docs/offsite/other.html#Performance_and_Scalability

__
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
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: make test fails- can't find My::child_init

2003-11-26 Thread John Saylor
hi

( 03.11.26 10:45 -0800 ) Stas Bekman:
> Aha! Sorry for missing this point. Any luck with this patch?

> Index: t/docs/startup.pl
> ===
> RCS file: /home/cvs/modperl/t/docs/startup.pl,v
> retrieving revision 1.44
> diff -u -r1.44 startup.pl
> --- t/docs/startup.pl   23 May 2002 03:07:27 -  1.44
> +++ t/docs/startup.pl   26 Nov 2003 18:41:25 -
> @@ -142,7 +142,7 @@
>  @MyClass::ISA = qw(BaseClass);
> 
>  #testing child init/exit hooks
> -
> +$INC{"My.pm"} = __FILE__;
>  sub My::child_init {
>  my $r = shift;
>  eval {

no. 

here's what comes on the screen after i've applied the patch:
cp t/conf/mod_perl_srm.conf t/conf/srm.conf
./apaci/load_modules.pl ../apache_1.3.29/src
../apache_1.3.29/src/httpd -f `pwd`/t/conf/httpd.conf -X -d `pwd`/t &
httpd listening on port 8529
will write error_log to: t/logs/error_log
letting apache warm up...\c
done
/usr/bin/perl t/TEST 0
still waiting for server to warm up...not ok
server failed to start! (please examine t/logs/error_log) at t/TEST line 95.
make: *** [run_tests] Error 111


and this is what's in the error log:
[Wed Nov 26 15:41:19 2003] [error] Can't locate My/child_init.pm in @INC (@INC c
ontains: /usr/lib/perl5/5.8.0/i686-linux /usr/lib/perl5/5.8.0 /usr/lib/perl5/sit
e_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl/
5.6.1 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i686-linux /usr/
lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl . /usr/local/src/mod_perl
-1.29/t/ /usr/local/src/mod_perl-1.29/t/lib/perl) at (eval 5) line 3.

[Wed Nov 26 15:41:19 2003] [error] Undefined subroutine &My::child_init::handler
 called at PerlChildInitHandler subroutine `My::child_init' line 1.


basically, no change.

if i modify t/conf/httpd.conf to include this line:
PerlRequire docs/startup.pl

just before this line:
PerlChildInitHandler My::child_init

i get different errors:
./apaci/load_modules.pl ../apache_1.3.29/src
../apache_1.3.29/src/httpd -f `pwd`/t/conf/httpd.conf -X -d `pwd`/t &
httpd listening on port 8529
will write error_log to: t/logs/error_log
letting apache warm up...\c
PerlSetEnv is broken
done
/usr/bin/perl t/TEST 0
still waiting for server to warm up...not ok
server failed to start! (please examine t/logs/error_log) at t/TEST line 95.
make: *** [run_tests] Error 111


and this is what's in the error_log:
[notice] END block called for startup.pl
[notice] Destruction->DESTROY called for $global_object
PerlSetEnv is broken
[Wed Nov 26 15:42:40 2003] [warn] pid file 
/usr/local/src/mod_perl-1.29/t/logs/httpd.pid overwritten -- Unclean shutdown of 
previous Apache run?
[Wed Nov 26 15:42:41 2003] [warn] [notice] child_init for process 14682, report any 
problems to [no address given]

[notice] child process 14682 terminating
[notice] push'd PerlChildExitHandler called, pid=14682
[notice] END block called for startup.pl
[notice] Destruction->DESTROY called for $global_object


however the httpd is still running:
14921 pts/0S  0:00 ../apache_1.3.29/src/httpd -f 
/usr/local/src/mod_perl-1.29/t/conf/httpd.conf -X -d /usr/local/src/mod_perl-1.29/t


any suggestions are welcome.

-- 
\js "don't panic"


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: Updating "constant" datastructures in MP2

2003-11-26 Thread Elizabeth Mattijsen
At 11:13 -0800 11/26/03, Stas Bekman wrote:
Elizabeth Mattijsen wrote:
I was wondering whether the following trick could somehow work with 
mod_perl 2.  And excuse my preference for prefork MPM's: I guess 
that's the hammer to work on all my nails (pun intended).  I'm open 
to other solutions to this "problem"!
Liz, when you are talking about prefork mpm, you get a better chance 
to get more people to read your question if you don't mention mp2. 
My guess is that folks won't even try to reply, since they aren't 
familiar with mp2. But your question applies to mp1 just as well.
I'll keep that in mind next time...  but I was under the impression 
that I could only do this in MP2 because that's where there is a 
Perl*Handler running in the parent for each request, or sequence of 
request in the case of Keep-Alive.  To my knowledge, you can't do 
that in MP1, or can you?


When you're using prefork MPM, you try to create as many constant 
data-structures as possible before the children are being forked. 
Sometimes, these structures require updating during the lifetime of 
the server, but the updated information does not need to be 
available to all the currently running children.  And/Or you don't 
want the server to be completely restarted for that.  An example 
would be a blacklist of IP-numbers that you want to block, or 
indexes that only need updating if a new entry is added.
If I remember correctly, you mentioned this to me back at 
YAPC::Paris in July. But back then you said you are going to 
gracefully restart the child processes, after updating the parent's 
data so that the newly spawned processes will see the updated info. 
It won't work in any other way.
Having to gracefully restart is what I'm trying to prevent, really. 
My experience so far with grceful restarts hasn't been very 
favourable.  Was I wrong?


You are probably much better off using a dbm file or some other 
external cache, so that you don't need to look for tricky solutions. 
David Harris wrote Apache::DB_File which is optimized for 
read-often/update-rarely case.
I'll have a look at that...


and a Perl*Handler (PreConnection?) is installed.  This handler 
should run _inside_ the parent before each request.  It would 
conceptually go like this:
PreConnection will work only if you don't use KeepAlive. With 
KeepAlive it'll be executed once for the whole connection.
That's fine...


If you are talking about serving HTTP, you probably want 
PerlInitHandler. Similar to Apache::Reload.
But PerlInitHandler runs in the child, does it not?

Liz

--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Updating "constant" datastructures in MP2

2003-11-26 Thread Stas Bekman
Elizabeth Mattijsen wrote:
At 11:13 -0800 11/26/03, Stas Bekman wrote:

Elizabeth Mattijsen wrote:

I was wondering whether the following trick could somehow work with 
mod_perl 2.  And excuse my preference for prefork MPM's: I guess 
that's the hammer to work on all my nails (pun intended).  I'm open 
to other solutions to this "problem"!
Liz, when you are talking about prefork mpm, you get a better chance 
to get more people to read your question if you don't mention mp2. My 
guess is that folks won't even try to reply, since they aren't 
familiar with mp2. But your question applies to mp1 just as well.


I'll keep that in mind next time...  but I was under the impression that 
I could only do this in MP2 because that's where there is a Perl*Handler 
running in the parent for each request, or sequence of request in the 
case of Keep-Alive.  To my knowledge, you can't do that in MP1, or can you?
Which Perl*Handlers you are talking about? There are twice as many of them in 
MP2. All Perl*Handlers from mp1, but ChildInit/Exit run during the request. If 
you are talking about the parent process, the one which has spawned the child 
processes, there is no hook running in it during the request, it has no idea 
the child is doing anything at all, besides the limited info provided by the 
scoreboard.

When you're using prefork MPM, you try to create as many constant 
data-structures as possible before the children are being forked. 
Sometimes, these structures require updating during the lifetime of 
the server, but the updated information does not need to be available 
to all the currently running children.  And/Or you don't want the 
server to be completely restarted for that.  An example would be a 
blacklist of IP-numbers that you want to block, or indexes that only 
need updating if a new entry is added.
If I remember correctly, you mentioned this to me back at YAPC::Paris 
in July. But back then you said you are going to gracefully restart 
the child processes, after updating the parent's data so that the 
newly spawned processes will see the updated info. It won't work in 
any other way.


Having to gracefully restart is what I'm trying to prevent, really. My 
experience so far with grceful restarts hasn't been very favourable.  
Was I wrong?
I have no idea. You were the one who suggested this solution back in July and 
you said that it just worked, when I said that I was skeptical about it ;)

If you are talking about serving HTTP, you probably want 
PerlInitHandler. Similar to Apache::Reload.


But PerlInitHandler runs in the child, does it not?
They all run in the child. The only hooks run by the parent process that 
spawns the child processes is PostConfig and OpenLogs, which happen at the 
server startup.

__
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
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: make test fails- can't find My::child_init

2003-11-26 Thread Stas Bekman
John Saylor wrote:
[...]
and this is what's in the error log:
[Wed Nov 26 15:41:19 2003] [error] Can't locate My/child_init.pm in @INC (@INC c
ontains: /usr/lib/perl5/5.8.0/i686-linux /usr/lib/perl5/5.8.0 /usr/lib/perl5/sit
e_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl/
5.6.1 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i686-linux /usr/
lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl . /usr/local/src/mod_perl
-1.29/t/ /usr/local/src/mod_perl-1.29/t/lib/perl) at (eval 5) line 3.
[Wed Nov 26 15:41:19 2003] [error] Undefined subroutine &My::child_init::handler
 called at PerlChildInitHandler subroutine `My::child_init' line 1.
and if you add:

  $INC{"My/child_init.pm"} = __FILE__;

similar to my previous patch.

This is not the right solution, but something to try. For some reason it can't 
see the sub child_init created in startup.pl, and tries to find it in 
My/child_init.pm, the curse we have finally removed in mp2.

I suppose that once you add it, it won't complain about My/child_init.pm, but 
will now complain about  Undefined subroutine &My::child_init

__
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
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Updating "constant" datastructures in MP2

2003-11-26 Thread Elizabeth Mattijsen
At 13:41 -0800 11/26/03, Stas Bekman wrote:
If I remember correctly, you mentioned this to me back at 
YAPC::Paris in July. But back then you said you are going to 
gracefully restart the child processes, after updating the 
parent's data so that the newly spawned processes will see the 
updated info. It won't work in any other way.
Having to gracefully restart is what I'm trying to prevent, really. 
My experience so far with grceful restarts hasn't been very 
favourable.  Was I wrong?
I have no idea. You were the one who suggested this solution back in 
July and you said that it just worked, when I said that I was 
skeptical about it ;)
I think I said it _should_ work...  ;-)


If you are talking about serving HTTP, you probably want 
PerlInitHandler. Similar to Apache::Reload.
But PerlInitHandler runs in the child, does it not?
They all run in the child. The only hooks run by the parent process 
that spawns the child processes is PostConfig and OpenLogs, which 
happen at the server startup.
Ok, so much for that idea then...  if there is no handler running in 
the parent for each request, then my idea won't fly...   unless I do 
all of this in a signal handler in the parent...would that fly? 
Something like this in PerlRequire:

my $updating;
$SIG{123} = sub {
return if $updating++;  # make sure only one at a time
#update data structures;
$updating = 0;
};


Liz

--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Updating "constant" datastructures in MP2

2003-11-26 Thread Stas Bekman
Elizabeth Mattijsen wrote:

If you are talking about serving HTTP, you probably want 
PerlInitHandler. Similar to Apache::Reload.
But PerlInitHandler runs in the child, does it not?
They all run in the child. The only hooks run by the parent process 
that spawns the child processes is PostConfig and OpenLogs, which 
happen at the server startup.


Ok, so much for that idea then...  if there is no handler running in the 
parent for each request, then my idea won't fly...   unless I do all of 
this in a signal handler in the parent...would that fly? Something like 
this in PerlRequire:

my $updating;
$SIG{123} = sub {
return if $updating++;  # make sure only one at a time
#update data structures;
$updating = 0;
};
That's what you told me back in July, which I liked. Though I haven't seen it 
at work yet.

But if you do that already, why not just hup the server right away and let it 
reread the cached data that some child has updated. So you could have the 
readonly cache preloaded at the server startup, initialized from the writable 
cache which can be updated by an external process or an httpd child, but which 
won't affect the read-only copy. I think Apache::DB_File is just what you are 
after.

I don't think there is any other way to make parent do something. Remember 
that all it does is sitting in a tight loop and watching after the number of 
available child processes and spawns new ones/kills old ones.

__
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
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Updating "constant" datastructures in MP2

2003-11-26 Thread Elizabeth Mattijsen
At 14:02 -0800 11/26/03, Stas Bekman wrote:
Elizabeth Mattijsen wrote:
my $updating;
$SIG{123} = sub {
return if $updating++;  # make sure only one at a time
#update data structures;
$updating = 0;
};
That's what you told me back in July, which I liked. Though I 
haven't seen it at work yet.
okokok...  ;-)


But if you do that already, why not just hup the server right away 
and let it reread the cached data that some child has updated.
hup it as in graceful restart?  But I don't need it to re-read all of 
my Perl modules, plus their inherent initializations...  I just need 
e.g. a hash updated...


So you could have the readonly cache preloaded at the server 
startup, initialized from the writable cache which can be updated by 
an external process or an httpd child, but which won't affect the 
read-only copy.
If I read you right: but I _do_ want to update the read-only copy, so 
that it becomes shared with all new children...


I think Apache::DB_File is just what you are after.
Is that on CPAN?  I can't find it.  I _can_ find 
Apache::Session::DB_File and Apache::Session::Store::DB_File, is that 
what you mean?


I don't think there is any other way to make parent do something. 
Remember that all it does is sitting in a tight loop and watching 
after the number of available child processes and spawns new 
ones/kills old ones.
But the select loop is in the parent, isn't it?  It would make sense 
to me to have the PreConnectionHandler run in the parent, so it 
doesn't need to start up a child, only to find out that you won't 
accept the connection...

But anyway, I'll first go an try to see whether a signal handler will 
do the trick...  ;-)

Liz

--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Updating "constant" datastructures in MP2

2003-11-26 Thread Stas Bekman

I think Apache::DB_File is just what you are after.


Is that on CPAN?  I can't find it.  I _can_ find 
Apache::Session::DB_File and Apache::Session::Store::DB_File, is that 
what you mean?
Sorry, I messed up the names and owners. I meant Tie::DB_Lock by Ken Williams, 
David's DB_File::Lock is somewhat related

I don't think there is any other way to make parent do something. 
Remember that all it does is sitting in a tight loop and watching 
after the number of available child processes and spawns new 
ones/kills old ones.


But the select loop is in the parent, isn't it?  
Not necessarily, in httpd-2.0 an mpm module may implement it in a different 
way, but I think it is in prefork mpm.

It would make sense to 
me to have the PreConnectionHandler run in the parent, so it doesn't 
need to start up a child, only to find out that you won't accept the 
connection...
Hmm, why do you try to make the parent run the PreConnection handler? let's 
assume for a second that it did so. All other incoming requests will be 
blocked as the parent won't be able to dispatch them to the workers. Though 
going back to my mpm note, above, you can implement your own mpm which will do 
what you want. Also did you see:
http://perl.apache.org/docs/2.0/user/handlers/protocols.html#PerlPreConnectionHandler
just substitute the inlined hash with a dbm file, add locking with 
DB_File::Lock or use Tie::DB_Lock and you are all set.

__
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
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: Updating 'constant' datastructures in MP2

2003-11-26 Thread Perrin Harkins
> hup it as in graceful restart?  But I don't need it to re-read all of
> my Perl modules, plus their inherent initializations...  I just need
> e.g. a hash updated...

I agree with Stas -- it would be easier to use something like a dbm. 
MLDB::Sync works well for this stuff.
When I've had to do this in the past, I've typically just used last
modtime check on some file as a form of notification, and have children
update their data as necessary.  This has the advantage of being easy, but
the disadvantage that the data is no longer shared.  I don't think you can
reall solve that without HUP-ing the server, but if you find a way I'll be
eager to hear about it.
- Perrin



-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: Caching CGI scripts running under Apache::Registry

2003-11-26 Thread Perrin Harkins
> Thanks to your pointers, I've managed to write a subclass of
> Apache::RegistryNG which captures what would have been the output of
> Apache::RegistryNG and writes it into '/tmp/foo'. (Attached file).
>
> However, I cannot get this same module to actually send correctly the
> captured output... Have you got any suggestions?

Well, if you have the output in a variable, just print it.  I would second
Randal's suggestion about using a caching proxy server though.
- Perrin



-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: mod_perl httpd doesn't start as DSO

2003-11-26 Thread BeerBong
> > But...
> > I found a line in startup.pl, which brokes Apache:
> > use DBD::Oracle
> >
> > I don't know why, but simple scripts on this machine kinda
> > --
> > use strict;
> > use DBI;
> >
> > $ENV{ORACLE_HOME} = "/u01/app/oracle/product/8.1.7";
> > $ENV{NLS_LANG} = "AMERICAN_AMERICA.CL8MSWIN1251";
> >
> > my $dbh = DBI->connect('DBI:Oracle:SIMain', '', '');
> > my $news = $dbh->selectrow_array("select count(*) from
portal.contents");
> > print "$news\n";
> > $dbh->disconnect;
> > --
> > works fine...
>
> But you don't load DBD::Oracle explicitly here, as you do in the
startup.pl.
> Any difference if you omit 'use DBD::Oracle' and just keep 'use DBI'?

I just wanted to load DBD::Oracle in parent process for sharing it among
children.
(and it works fine for statically compiled mod_perl)...
-
use strict;
use DBI;

my $r = shift;
$r->send_http_header('text/plain');
my $dbh = DBI->connect('DBI:Oracle:SIMain', '', '');
my $news = $dbh->selectrow_array("select count(*) from portal.contents");
$r->print ($news);
-
Although above Apache::Registry script works for DSO mod_perl ...

--
Sergey Polyakov aka BeerBong
Chief of WebZavod http://www.webzavod.ru
Tel. +7 (8462) 43-93-85 | +7 (8462) 43-93-86
  mailto:[EMAIL PROTECTED]


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html