Re: libapreq-1.1 Release Candidate 1

2002-11-26 Thread Ken Williams
Edward,

Instead of just ./configure, you'll need to do
./configure --with-apache-includes=/usr/include/httpd
(assuming that's where your apache headers are).

That'll get you farther, anyway.

Joe, maybe this could be added as a default for Darwin or something?


 -Ken


On Tuesday, November 26, 2002, at 01:12  PM, Edward Moon wrote:


PowerBook Ti 667 Rev1 (1GB RAM 30GB HD)
OS X 10.2
Apache 1.3.27 installed at Apple default (custom build w/ 
mod_perl 1.27)
Apache 2.0.43 installed at /usr/local/apache2

Ran configure then make and got the error:
cpp-precomp: warning: errors
during smart preprocessing, retrying in basic
mode
make[1]: *** [apache_cookie.lo] Error 1
make: *** [all-recursive] Error 1

Gory details follows:

[honeycrisp:~/src/httpd-apreq] em% ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets ${MAKE}... yes
checking for gcc... gcc
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc
checking build system type... powerpc-apple-darwin6.2
checking host system type... powerpc-apple-darwin6.2
checking for ld used by GCC... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... no
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -p
checking whether ln -s works... yes
checking how to recognise dependant libraries... file_magic Mach-O
dynamically linked shared library
checking command to parse /usr/bin/nm -p output... ok
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... no
checking dlfcn.h presence... no
checking for dlfcn.h... no
checking for ranlib... ranlib
checking for strip... strip
checking for objdir... .libs
checking for gcc option to produce PIC... -fno-common
checking if gcc PIC flag -fno-common works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.lo... yes
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking whether the linker (/usr/bin/ld) supports shared 
libraries... yes
checking how to hardcode library paths into programs... unsupported
checking whether stripping libraries is possible... no
checking dynamic linker characteristics... darwin6.2 dyld
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
creating libtool
checking for ranlib... (cached) ranlib
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating c/Makefile
config.status: executing depfiles commands
[honeycrisp:~/src/httpd-apreq] em% make
Making all in c
source='apache_cookie.c' object='apache_cookie.lo' libtool=yes \
depfile='.deps/apache_cookie.Plo' 
tmpdepfile='.deps/apache_cookie.TPlo' \
depmode=gcc /bin/sh ../depcomp \
/bin/sh ../libtool --mode=compile gcc -DPACKAGE_NAME=\\
-DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -DPACKAGE_STRING=\\
-DPACKAGE_BUGREPORT=\\ -DPACKAGE=\libapreq\ -DVERSION=\1.1\
-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1
-DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 
-DHAVE_STRINGS_H=1
-DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1  -I. -I.
-I/usr/local/apache/include-g -O2 -c -o apache_cookie.lo `test -f
'apache_cookie.c' || echo './'`apache_cookie.c
mkdir .libs
gcc -DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\
-DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -DPACKAGE=\libapreq\
-DVERSION=\1.1\ -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1
-DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 
-DHAVE_MEMORY_H=1
-DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 
-DHAVE_UNISTD_H=1
-I. -I. -I/usr/local/apache/include -g -O2 -c apache_cookie.c
-Wp,-MD,.deps/apache_cookie.TPlo  -fno-common -DPIC -o
..libs/apache_cookie.lo
apache_request.h:5: header file 'httpd.h' not found
apache_request.h:6: header file 'http_config.h' not found
apache_request.h:7: header file 'http_core.h' not found
apache_request.h:8: header file 'http_log.h' not found
apache_request.h:9: header file 'http_main.h' not found
apache_request.h:10: header file 'http_protocol.h' not found

Re: libapreq-1.1 Release Candidate 1

2002-11-25 Thread Ken Williams
Hi Joe  APReq,

I'm glad this is receiving attention, Apache::Request has had 
some trouble on OS X as I'm sure you're aware.  I just tested 
the RC, using:

 perl 5.6.1
 Apache/1.3.26 (as shipped with the OS, uses dso)
 OS X 10.1.5

and I get this error in 'make test':

dyld: t/httpd multiple definitions of symbol _ApacheRequest___parse
blib/arch/auto/Apache/Request/Request.bundle definition of 
_ApacheRequest___parse
blib/arch/auto/Apache/Cookie/Cookie.bundle definition of 
_ApacheRequest___parse
make: *** [start_httpd] Error 66

I believe this was the same error from several months ago, that 
the binary namespaces of Apache::Request and Apache::Cookie are 
conflicting.

I've attached the full output.

 -Ken

On Tuesday, November 26, 2002, at 10:34  AM, Joe Schaefer wrote:


The apreq developers are planning a maintenance release of
libapreq-1.1.  This version does not include support for
modperl-2, but it does address some outstanding problems in
1.0:

  * OS X support
  * perl 5.8 segfaults related to file uploads.

Please give the tarball at

  http://www.apache.org/~joes/libapreq-1.1_rc1.tar.gz

a try and report comments/problems/etc. to the apreq-dev list
at [EMAIL PROTECTED]  There are special build
instructions for OS X, so be sure to have a look at

  http://www.apache.org/~joes/

for details on OS X support.  We'll be patching the INSTALL 
README documents based on OS X user feedback.

Note:  We really could use more volunteers participating
in apreq-dev, especially folks with OS X experience.  Even though
libapreq is a small (ASF) project, there's plenty of work to be
done- both in improving/supporting the libapreq-1.x codebase as
well as porting apreq to modperl-2.

Thanks.

--
Joe Schaefer



libapreq-out
Description: application/applefile


libapreq-out
Description: Binary data


Re: libapreq-1.1 Release Candidate 1

2002-11-25 Thread Ken Williams

On Tuesday, November 26, 2002, at 12:22  PM, Joe Schaefer wrote:


Ken Williams [EMAIL PROTECTED] writes:

[...]


I've attached the full output.


Thanks, Ken.  I looked over the result, but didn't see any
indication that you used the ./configure - make - make install
instructions from the web page.


D'oh!  I just looked at the INSTALL file, despite your 
admonitions to the contrary.  Sorry to overlook it.

I got through ./configure - make - make install 
successfully, installing to /usr/local/lib/ and 
/usr/local/include/.  However, there doesn't seem to be a 
ldconfig on my system ('locate' couldn't find one anywhere, 
and I checked manually in /sbin/ and /usr/sbin/).

Did the libtool-based build
of libapreq install successfully before you tried doing the perl
build?


This time around, I installed libapreq and then did 'perl 
Makefile.PL; make test;' and got a different error.  Looks like 
the server didn't start properly.

I've attached the terminal output, and the httpd.conf in case 
it's helpful.  The t/error_log is unremarkable (just a bunch of 
stuff like [warn] module mod_log_config.c is already added, 
skipping).


 -Ken


libapreq-out
Description: application/applefile


libapreq-out
Description: Binary data


httpd.conf
Description: Binary data


Re: libapreq-1.1 Release Candidate 1

2002-11-25 Thread Ken Williams

On Tuesday, November 26, 2002, at 05:24  PM, Joe Schaefer wrote:


Ken Williams [EMAIL PROTECTED] writes:

[...]


I got through ./configure - make - make install
successfully, installing to /usr/local/lib/ and
/usr/local/include/.  However, there doesn't seem to be a
ldconfig on my system ('locate' couldn't find one anywhere,
and I checked manually in /sbin/ and /usr/sbin/).


According to

http://fink.sourceforge.net/doc/porting/porting.html

OS X doesn't have/need an ldconfig binary (I'll update the web page).

Try running the BUILD.sh script first.  It'll rebuild the libtool/
autoconf/automake utilities by using to your machine's version,
instead of the ones I included in the tarball (which are based on
my linux box).  You might try running that first, and then doing
the ./configure - make - make install mojo before building
the perl tests.


Promising, but several errors ensue:

[pe-242:~/Downloads/perl/httpd-apreq] ken% ./BUILD.sh
./BUILD.sh: command not found: libtoolize [4]
./BUILD.sh: command not found: aclocal [5]
FATAL ERROR: Autoconf version 2.52 or higher is required for this script
./BUILD.sh: command not found: automake [7]
[pe-242:~/Downloads/perl/httpd-apreq] ken% which autoconf
/usr/bin/autoconf
[pe-242:~/Downloads/perl/httpd-apreq] ken% autoconf --version
Autoconf version 2.13

Is it possible to backport the process to older autoconfs, or 
are new features required?

 -Ken



Re: problems on OS X

2002-05-20 Thread Ken Williams

Great, the CVS version passes all tests for me now when built 
under 'perl Makefile.PL EVERYTHING=1' using apache 1.3.24.

On Tuesday, May 21, 2002, at 07:19  AM, Doug MacEachern wrote:
 On Sun, 28 Apr 2002, Ken Williams wrote:

 
 Insecure dependency in eval while running with -T switch.
 Callback called exit.
 

 this has been fixed in modperl cvs, just remove the 'use
 ExtUtils::testlib;' line in t/docs/startup.pl




  -Ken




Using a 404 ErrorDocument to serve content

2002-05-05 Thread Ken Williams

Hi,

I was thinking of writing yet-another-photo-album-server, and I 
had the idea that I'd write a handler to serve resized versions 
of JPEGs (very original, I know ;-).  The idea is that I'd put a 
bunch of JPEGs on the server at locations like foo/123.jpg , and 
then if a request came for foo/123-medium.jpg , I'd catch that 
with a 404 ErrorDocument and generate the resized image using 
Imager.  If I wanted to, I could also create the resized image 
on disk, so it wouldn't need to be generated next time.

Some questions arise, however.  I've got it working by setting 
$r-content_type(image/jpeg) in the 404 subrequest.  Should I 
also be setting $r-prev-content_type ?  Same question for 
$r-status and $r-prev-status.  It seems to be working 
either way, but I don't know what the proper thing to do is.

The idea is that I'm not just trying to give the user a friendly 
404 error message, I'm trying to fool the user into thinking the 
requested document really does exist.  I've done this a lot with 
Location and so on, but I don't think I've ever tried it with 
an ErrorDocument, so I'm interested in feedback.

  -Ken




Re: Cheap and unique

2002-05-03 Thread Ken Williams


On Wednesday, May 1, 2002, at 06:46 AM, OCNS Consulting wrote:
 Of course srand seeds rand. And yes, it is a good way to generate
 random numbers for a one time application RUN.

The original poster is not looking for random, he's looking 
for unique.  These are in many ways *opposite* requirements, 
as the only reliable way to get unique IDs is to use a very 
deterministic procedure - a simple iterator is one of the 
easiest and best.

If you have the additional requirement that the unique values 
shouldn't be easily *guessable*, that becomes a very hard 
problem, precisely because random and unique are such poor 
friends.  Usually people just cheat by generating a large random 
ID such that the probability of it being already-used is low, 
and then they check all the previous IDs to make sure.


  -Ken




Re: Can mod_perl help me use ENV variables in httpd.conf?

2002-05-02 Thread Ken Williams


On Wednesday, May 1, 2002, at 05:04 AM, Fran Fabrizio wrote:


 I spoke too soon.

 I need:

 Perl
   push Alias, [ qw(/cgi-bin/chimpkit/ $ENV{SERVER_ROOT}/cgi-
 bin/chimpkit/) ];
 /Perl

 This does not appear to be possible because there's no way to 
 pass in SERVER_ROOT to the apache startup.

I think the problem is your Perl syntax, not the value of the 
variable.  Scalars do not interpolate in qw() constructs.  Try 
this instead:

Perl
   push Alias, '/cgi-bin/chimpkit/', $ENV{SERVER_ROOT}/cgi-
bin/chimpkit/;
/Perl

or even

Perl
   push Alias, '/cgi-bin/chimpkit/',
$r-server_root_relative . '/cgi-bin/chimpkit/';
/Perl

  -Ken




Re: problems on OS X

2002-04-28 Thread Ken Williams


On Sunday, April 28, 2002, at 04:48 PM, Stas Bekman wrote:
 it does solve the problem on linux. Ken, can you test the 
 bleadperl? This fix was applied as a solution. If `pwd` doesn't 
 work for you, that sucks! Meaning that the problem wasn't fixed 
 in bleadperl :( Can you check the recent Cwd thread on p5p 
 (started by me) and try running cwd.t under -T?

All bleadperl tests pass for me, except 'ext/DB_File/t/db-recno' 
which I think is known to fail.

Both Cwd tests pass, in particular:

   ext/Cwd/t/cwd...ok
   ext/Cwd/t/taint.ok

But you mention running them with -T - how do I do that?


 If I also do $ENV{PATH} = '/bin'; after that, the server 
 gets farther before failing (this is with a fully static 
 build - I'm giving up on APACI for now, I get link errors 
 there).  Now I get this error in t/logs/error_log:
 
 Insecure dependency in eval while running with -T switch.
 Callback called exit.
 
 Doesn't exactly tell me where to start looking for the error, 
 anyone have hints?  The above is the entire contents of the 
 log.

 Doug has started fixing this problem, but didn't finish. See:
 http://marc.theaimsgroup.com/?t=10188093473r=1w=2

Hmm, I'm now seeing different behavior than what I saw before.  
Using APACI and your Cwd.pm patch, the server never started, nor 
did it create t/logs/error_log.  I just tried it now with a 
simple static build, though, and it did succeed.  All mod_perl 
tests pass, though there are lots of warnings during the tests 
about Can't exec 'pwd': No such file or directory.  That's to 
be expected?

  -Ken




Re: problems on OS X

2002-04-28 Thread Ken Williams


On Sunday, April 28, 2002, at 04:48 PM, Stas Bekman wrote:
 Ken Williams wrote:
 On Sunday, April 28, 2002, at 01:47 PM, Stas Bekman wrote:
 Ken, CWD.pm, has always suffered from taint problems. This problem 
 has been fixed in the bleadperl, try this patch:

 --- /tmp/Cwd.pmSun Apr 28 11:44:38 2002
 +++ /home/stas/perl.org/perl-5.6.1/lib/Cwd.pmFri Sep 14 17:09:10 
 2001
  -89,7 +89,6 
  # The 'natural and safe form' for UNIX (pwd may be setuid root)

  sub _backtick_pwd {
 +local ENV{qw(PATH IFS CDPATH ENV BASH_ENV)};
  my $cwd = `pwd`;
  # `pwd` may fail e.g. if the disk is full
  chomp($cwd) if defined $cwd;
 This still fails, because it won't find `pwd` without a path.

 it does solve the problem on linux. Ken, can you test the bleadperl? 
 This fix was applied as a solution.

I sent a message earlier today saying that this patch seems to help 
things, but I just noticed something disturbing.  After hand-applying 
this patch to my CWD.pm from 5.6.1, I ran a 'perl Makefile.PL' for a 
different module (Apache::SSI), and it created the Makefile not in the 
current directory, but in my *home* directory!  Weird.  I don't know why 
it happened yet, but obviously this isn't a good thing.

I don't see how this patch can be right - how is it supposed to execute 
`pwd` if there's nothing in $ENV{PATH}?

  -Ken




problems on OS X

2002-04-27 Thread Ken Williams

Hi,

I used to be able to compile mod_perl pretty easily on Mac OS X, but now 
for some reason (upgrades of modules?  OS upgrades?) I'm having a lot of 
trouble getting past 'make test'.  Here's what happens (no matter 
whether I compile statically with just EVERYTHING=1, or as a DSO as per 
http://david.wheeler.net/osx.html):



[junior:~/Downloads/perl/mod_perl-1.26] ken% make test
cp t/conf/mod_perl_srm.conf t/conf/srm.conf
/usr/local/src/apache_1.3.23/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
[Sun Apr 28 12:29:28 2002] [error] Insecure $ENV{PATH} while running 
with -T switch at /System/Library/Perl/Cwd.pm line 92.
BEGIN failed--compilation aborted at 
/System/Library/Perl/ExtUtils/testlib.pm line 6.
Compilation failed in require at 
/Users/ken/Downloads/perl/mod_perl-1.26/t//docs/startup.pl line 9.
BEGIN failed--compilation aborted at 
/Users/ken/Downloads/perl/mod_perl-1.26/t//docs/startup.pl line 9.
Compilation failed in require at (eval 1) line 1.



It's possible that it might have something to do with 
ExtUtils::MakeMaker and its seedy friends, because I've been helping 
work on that and installing betas from time to time.  But I'm not sure 
where to start looking at that.  I'm currently using EU::MM 5.91_01.

Any suggestions?


  -Ken

% uname -a:
Darwin junior 5.4 Darwin Kernel Version 5.4: Wed Apr 10 09:27:47 PDT 
2002; root:xnu/xnu-201.19.3.obj~1/RELEASE_PPC  Power Macintosh powerpc


Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
   Platform:
 osname=darwin, osvers=5.2, archname=darwin
 uname='darwin junior 5.2 darwin kernel version 5.2: fri dec 7 
21:39:35 pst 2001; root:xnuxnu-201.14.obj~1release_ppc power macintosh 
powerpc '
 config_args='-des -Dfirstmakefile=GNUmakefile 
-Dldflags=-flat_namespace'
 hint=previous, 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 ='-pipe -fno-common -DHAS_TELLDIR_PROTOTYPE 
-fno-strict-aliasing',
 optimize='-O3',
 cppflags='-pipe -fno-common -DHAS_TELLDIR_PROTOTYPE 
-fno-strict-aliasing'
 ccversion='', gccversion='Apple devkit-based CPP 6.02', 
gccosandvers=''
 intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', 
lseeksize=8
 alignbytes=8, usemymalloc=n, prototype=define
   Linker and Libraries:
 ld='cc', ldflags ='-flat_namespace -L/usr/local/lib'
 libpth=/usr/local/lib /usr/lib
 libs=-lm -lc
 perllibs=-lm -lc
 libc=/System/Library/Frameworks/System.framework/System, so=dylib, 
useshrplib=true, libperl=libperl.dylib
   Dynamic Linking:
 dlsrc=dl_dyld.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
 cccdlflags=' ', lddlflags='-flat_namespace -bundle -undefined 
suppress -L/usr/local/lib'


Characteristics of this binary (from libperl):
   Compile-time options: USE_LARGE_FILES
   Built under darwin
   Compiled at 12/31/01 02:02:01
   INC:
 /System/Library/Perl/darwin
 /System/Library/Perl
 /Library/Perl/darwin
 /Library/Perl
 /Library/Perl
 /Network/Library/Perl/darwin
 /Network/Library/Perl
 /Network/Library/Perl
 .




Re: problems on OS X

2002-04-27 Thread Ken Williams


On Sunday, April 28, 2002, at 12:41 PM, Ken Williams wrote:
 I used to be able to compile mod_perl pretty easily on Mac OS 
 X, but now for some reason (upgrades of modules?  OS upgrades?) 
 I'm having a lot of trouble getting past 'make test'.  Here's 
 what happens (no matter whether I compile statically with just 
 EVERYTHING=1, or as a DSO as per 
 http://david.wheeler.net/osx.html):

Oops - as David pointed out to me, he doesn't recommend 
compiling as a DSO on that page.  I should have said whether or 
not I compile Apache with mod_so.  Or maybe whether I use 
APACI or build by hand.

  -Ken




Re: problems on OS X

2002-04-27 Thread Ken Williams


On Sunday, April 28, 2002, at 01:47 PM, Stas Bekman wrote:
 Ken, CWD.pm, has always suffered from taint problems. This problem has 
 been fixed in the bleadperl, try this patch:

 --- /tmp/Cwd.pm   Sun Apr 28 11:44:38 2002
 +++ /home/stas/perl.org/perl-5.6.1/lib/Cwd.pm Fri Sep 14 17:09:10 2001
  -89,7 +89,6 
  # The 'natural and safe form' for UNIX (pwd may be setuid root)

  sub _backtick_pwd {
 -local ENV{qw(PATH IFS CDPATH ENV BASH_ENV)};
  my $cwd = `pwd`;
  # `pwd` may fail e.g. if the disk is full
  chomp($cwd) if defined $cwd;

This still fails, because it won't find `pwd` without a path.  If I also 
do $ENV{PATH} = '/bin'; after that, the server gets farther before 
failing (this is with a fully static build - I'm giving up on APACI for 
now, I get link errors there).  Now I get this error in t/logs/error_log:


Insecure dependency in eval while running with -T switch.
Callback called exit.


Doesn't exactly tell me where to start looking for the error, anyone 
have hints?  The above is the entire contents of the log.


  -Ken




Re: SUCCESS: libapreq working in Mac OS X

2002-02-22 Thread Ken Williams


On Friday, February 22, 2002, at 09:58  AM, Joe Schaefer wrote:
 In the interim I'll try and maintain the experimental versions.
 Stas has been kind enough to work on adding a test suite to libapreq,
 which will very likely be included in the next release.

That'll be MUCH appreciated.  That's been a big stumbling block in 
trying to figure out what the deal is with libapreq on OS X.

 OTOH, I'd like to solicit some feedback on yet another installation
 process- first making libapreq a shared library, and then linking
 the Perl interfaces to *that* library (instead of libapreq.a).

I think that sounds like a better approach than the current one, I'll 
try to give it a shot.  I'm moving out of my apartment in the next few 
days though, so I might not get to it for a while.  Remind me if 
necessary.

  -Ken




Re: Apache::Session getting DESTROYed in wrong order

2002-01-17 Thread Ken Williams


On Friday, January 4, 2002, at 02:22 AM, Ken Williams wrote:
 For the sake of thread completion, here's a script which demonstrates 
 the bug.  It turns out to be a Perl bug (5.6.1, at least), not an 
 Apache::Session bug.  I'll post to p5p after I post here.

I was surprised to find the it's not a bug, it's a feature defense on 
p5p.  So here's an update.  The following is either a workaround, or the 
proper fix, depending on what you think Perl's proper behavior should 
be. ;-)

{
   local *session;
   tie %session, 'Apache::Session::MySQL', ...;
...
}


The local *session; is the important bit.  It doesn't work to do
local %session;, because %session will still be tied even after it 
goes out of scope, and thus the hash data will never get written to 
storage.

In a Mason context, which is where I'm using it, I do this in my 
top-level autohandler (ignore the main:: subroutines, they're just for 
pedagogy):


%init
  # 'local' so it's available to lower-level components
  local *session;

  my $dbh = ::get_dbh;
  my $session_id = ::get_cookie('_session_id');
  tie %session, 'Apache::Session::MySQL', $session_id,
   {Handle = $dbh, LockHandle = $dbh};
  ...
/%init


  -Ken




Re: Apache::Session getting DESTROYed in wrong order

2002-01-17 Thread Ken Williams


On Friday, January 18, 2002, at 12:44 AM, Perrin Harkins wrote:

 In a Mason context, which is where I'm using it, I do this in my
 top-level autohandler (ignore the main:: subroutines, they're just for
 pedagogy):


 %init
   # 'local' so it's available to lower-level components
   local *session;

   my $dbh = ::get_dbh;
   my $session_id = ::get_cookie('_session_id');
   tie %session, 'Apache::Session::MySQL', $session_id,
{Handle = $dbh, LockHandle = $dbh};
   ...
 /%init

 Geez, that's awfully confusing to look at (local and typeglobs is not a
 newbie-friendly combo).  Isn't there a simpler way?  What about putting
 it in pnotes?

I don't think there's a simpler way.  Putting it in pnotes means that 
all other components will also have to use $r-pnotes('session'), rather 
than just using %session.

Perhaps local(*session) is better than local *session?  It at least 
looks less like a pointer to local.  ;-)

  -Ken




[ANNOUNCE] Apache::SSI v2.17 uploaded

2002-01-14 Thread Ken Williams

Hi,

The uploaded file

 Apache-SSI-2.17.tar.gz

has entered CPAN as

   file: $CPAN/authors/id/K/KW/KWILLIAMS/Apache-SSI-2.17.tar.gz
   size: 25819 bytes
md5: b229a3a25a82935cad2da1af637714be

Changes since 2.16:

  2.17  Mon Jan 14 13:58:21 CST 2002
Added the Apache::FakeSSI class, which implements server-side
includes in pure-perl so that its output can be filtered via
Apache::Filter.  Note that its !--#exec cgi=...-- isn't
functional yet.

Fixed a problem with the MANIFEST - file t/docs.check/16 was missing.


  -Ken




Re: Apache::Session getting DESTROYed in wrong order

2002-01-04 Thread Ken Williams

Hey,

For the sake of thread completion, here's a script which demonstrates 
the bug.  It turns out to be a Perl bug (5.6.1, at least), not an 
Apache::Session bug.  I'll post to p5p after I post here.

Note that $foo and %bar are cleaned up by refcount, but %foo isn't 
cleaned up until global destruction.  This means there must be some bad 
interaction between tie(), closures, and global variables, I guess.

-
#!/usr/bin/perl

use strict;

{
   package Dummy;
   sub new { bless {@_[1,2]} }
   sub TIEHASH { bless {@_[1,2]} }
   sub DESTROY { warn Destroying $_[0]-{name}: $_[0] }
}

use vars qw(%foo $foo);

{
   # Will get cleaned up properly
   local $foo = new Dummy(name = '$foo');

   # Will get cleaned up properly
   my %bar;
   tie %bar, 'Dummy', name = '%bar';

   # Won't get cleaned up properly
   local %foo;
   tie %foo, 'Dummy', name = '%foo';
}

Destroying %bar: Dummy=HASH(0x632c) at destroy.pl line 9.
Destroying $foo: Dummy=HASH(0x641c) at destroy.pl line 9.
Destroying %foo: Dummy=HASH(0x22ccc) at destroy.pl line 9 during global 
destruction.


Investigating with Devel::Peek suggests that it's a %foo refcount 
problem, it's somehow getting set to 2 after tie(%foo).

  -Ken




Re: Apache::Session getting DESTROYed in wrong order

2002-01-04 Thread Ken Williams


On Friday, January 4, 2002, at 02:48 AM, Gerald Richter wrote:

# Won't get cleaned up properly
local %foo;
tie %foo, 'Dummy', name = '%foo';

 local only make a copy of the original value and restores it at the end 
 of
 the scope, so %foo will not destroyed, but restored at the end of the 
 scope.
 I guess this is the reason my it still stays tied.

AMS just posted this small test case to p5p:

 sub X::TIEHASH{bless{}}
 { local %x; tie %x, X } print tied %x ? a : b;

5.004_03 prints b, and 5.004_04 (and higher) prints a.  I think b 
is the proper behavior, at least that's my opinion.


  -Ken




Re: Apache::Session getting DESTROYed in wrong order

2002-01-03 Thread Ken Williams

Hi Aaron,

I don't have a test case involving Apache::Session yet (I've been out of 
town for a couple days), but here's a simple one in Perl that 
demonstrates the DESTROY order problem:

--
#!/usr/bin/perl

{
   package Outer;
   sub new { bless {inner = 'Inner'-new} }
   sub DESTROY { warn Destroying $_[0] }
}

{
   package Inner;
   sub new { bless {} }
   sub DESTROY { warn Destroying $_[0] }
}


{
   warn refcount destruction:\n;
   my $foo = 'Outer'-new;
}

warn \nglobal destruction:\n;
my $bar = 'Outer'-new;
$bar-{self} = $bar;
--

So I think I need to find out why the Apache::Session objects aren't 
being destroyed until global destruction time, i.e. why their refcounts 
aren't going to zero.

This is in the context of testing the new HTML::Mason 1.10, so something 
complicated might be happening with that too.

  -Ken


On Wednesday, January 2, 2002, at 04:15 AM, Aaron E. Ross wrote:
 refcount destruction.  I've declared %session as a locally-scoped
 variable, so it should evaporate before global destruction, unless it's
 got circular data structures or something.  Anyone know what might be
 going on?

  Do you have a simple case we can test yet?




Re: Apache::Session getting DESTROYed in wrong order

2002-01-03 Thread Ken Williams


On Thursday, January 3, 2002, at 11:57 AM, Perrin Harkins wrote:
 I don't have a test case involving Apache::Session yet (I've been out 
 of
 town for a couple days), but here's a simple one in Perl that
 demonstrates the DESTROY order problem:

 That's sort of a weird example, since it has a circular reference.  
 Does it
 have problems without the circular ref?

The circular reference was the only way I could think of to force an 
object to be destroyed during global destruction.  I don't know whether 
it has a problem without circularity or not.


 At a guess, I'd say you're making an unintentional closure somewhere.


Hmm, that may be - Mason does create more closures now than it used to.  
It seems like only 'named' closures would create this problem, though, 
and not 'anonymous' closures (since the refcount of the anonymous 
closure itself should go to zero, freeing its contents).  Mason is 
supposed to be using all anonymous closures.

I'm finding the destruction behavior highly unpredictable with the 
'named' closure actually, so maybe I should bring it up on p5p.  Perhaps 
the order of destruction is just random during global destruction, 
because I've seen it happen from the inside out  from the outside in.

  -Ken




Re: Apache::Session getting DESTROYed in wrong order

2002-01-03 Thread Ken Williams


On Thursday, January 3, 2002, at 02:02 PM, Jeffrey W. Baker wrote:
 This seems like a really weird problem.  The Store module is destroyed
 while another module still has a reference to it.  Unfortunately for you
 and I, the only conclusion I have been able to draw is that Perl's 
 DESTROY
 magic is unreliable.  We have modules in my company where things are
 randomly undefined in DESTROY subroutines, because the DESTROY of the
 referenced thing has already been called.  So, somewhere in Perl there 
 is
 a bug, possibly an off-by-one in the reference counting.

It's probably not the reference counting, since the global destruction 
phase uses a mark-and-sweep system rather than refcounts (and that's 
where my knowledge ends).

I think that the order of global object destruction is totally random, 
whereas refcount destruction is predictable.  After searching p5p, this 
seems to be known and accepted behavior.

I suppose there could be a refcount bug that's causing %session not to 
be cleaned up until global destruction.


 Anyway you can work around it.  Explicitly call tied(%session)-save()
 when the time is right.

True, I guess I'll do that, but I'd like to figure out a little more 
about it too.


  -Ken




Apache::Session getting DESTROYed in wrong order

2001-12-31 Thread Ken Williams

Hey,

I'm having problems with Apache::Session, the symptom is that none of my 
data is getting written to the database.  It's not the nested-data 
problem, since I'm not using any nested data structures.

After some investigation, I've discovered that the 
Apache::Session::Store::MySQL::DESTROY routine is getting called before 
the Apache::Session::MySQL::DESTROY routine, so when the latter is 
called it doesn't have any way to write to the database.

I think Perl is supposed to guarantee that the outer object's DESTROY is 
called before the inner object's, but I think maybe this guarantee 
doesn't extend to the global destruction phase.  So I'm wondering why 
the session is getting cleaned up in global destruction rather than 
refcount destruction.  I've declared %session as a locally-scoped 
variable, so it should evaporate before global destruction, unless it's 
got circular data structures or something.  Anyone know what might be 
going on?

This is Apache::Session version 1.53.

Note: this problem isn't related to mod_perl, but IIRC this list is the 
proper place for discussing Apache::Session.

  -Ken




Funny headers in modperl-site messages

2001-10-25 Thread Ken Williams

Does anyone know why messages sent to the modperl-site list have 
modperl-cvs in their headers, like the following?

List-Help: mailto:[EMAIL PROTECTED]
List-Unsubscribe: mailto:[EMAIL PROTECTED]
List-Post: mailto:[EMAIL PROTECTED]

 -Ken




Re: perl.apache.org / apache.perl.org

2001-10-18 Thread Ken Williams



Nathan Torkington [EMAIL PROTECTED] wrote:
 There are some web design To Do items:
  * ensure colors are part of the standard palette (right now they're
just easy to type in hex :-)

Holy shit Nat, those colors are strong. =)  You've really taken 
attention-getting into the twenty-first century!

Not that I dislike them - the current colors let me look at the page for a 
few seconds, then shut off the monitor and read the text while staring at a 
blank white sheet of paper.

In any case, I like the organizational scheme you've got.  Having 
everything on a single page was a pain in the butt.

 -Ken




Re: Apache::Gallery

2001-10-11 Thread Ken Williams

Michael,

Yeah, you can put it in the Apache namespace if it's mod_perl-dependent.
That's what it's there for. =)  The name Apache::Gallery seems decent.



Michael Legart [EMAIL PROTECTED] wrote:

 Hi,

 Apache::Gallery is a picture gallery implemented as a mod_perl handler,
 using libgd2 for on-the-fly image resizing (resized pictures are cached)
 and CGI::FastTemplate for easy customization.

 Demo can be seen at http://pictures.legart.dk/ordb/ and source can be
 downloaded from http://legart.dk/code/Apache-Gallery-0.1.1.tar.gz

 It is still at a very early stage, but i have alot of ideas for
 improvements...

 Would it be ok to upload this to CPAN in the Apache namespace?

 Thanks,
 Michael





Re: OT: secure mod_perl enabled apache on MacOSX 10.1

2001-10-11 Thread Ken Williams

Joe,

The problem is that Apple has made some strange changes to the way shared 
libraries are linked.  I'm not very conversant in the details, but there 
are some people on the [EMAIL PROTECTED] list that have discussed it.

Unfortunately, Apache::Request and Apache::Cookie don't define any tests, 
so a user can install them and think they're perfectly fine, but they 
fail pretty spectacularly when you try to use them. =(


Joe Schaefer [EMAIL PROTECTED] wrote:

 John Siracusa [EMAIL PROTECTED] writes:

 P.S.- d) Apache::Request and Apache::Cookie still can't be
 loaded simultaneously! :(

 Why not?  Does it work OK with a statically-linked mod_perl?

 --
 Joe Schaefer






RE: CGI.pm params not being cleared?

2001-10-02 Thread Ken Williams

Hi all,

It doesn't much matter whether you're using stacked handlers or not, or 
pushing vs. replacing, because the $r-child_terminate method seems to 
simply call the C exit(0) function under certain conditions (Win32, old 
version of apache, anything else?).  Not much chance of any further action 
if that's happening.

Under normal conditions child_terminate() is just supposed to set:
requests_this_child = ap_max_requests_per_child = 1;
which shouldn't be a problem.



Geoffrey Young [EMAIL PROTECTED] wrote:


 -Original Message-
 From: Perrin Harkins
 To: Alex Harper
 Cc: Daniel; [EMAIL PROTECTED]
 Sent: 10/1/01 11:35 PM
 Subject: Re: CGI.pm params not being cleared?

 Alex Harper wrote:

 Aha! That's where the problem lies. I had recently added:
 PerlCleanupHandler +Apache::Sizelimit

 to my httpd.conf. I placed it there so the sizelimit would be enforced
 post-request. Removing the line fixed my problem.

 Whoa!  This could be bad.  Apache::SizeLimit calls
 $r-post_connection().  Is that replacing existing cleanup handlers?  I
 thought post_connection()/register_cleanup() pushed handlers on the
 stack rather than replacing them.

 you know, I just tested this this afternoon - register_cleanup does push
 handlers onto the stack.  however, I have read a few bug reports in the
 archives that mention bugs along these lines - that sometimes the cleanup
 phase seems to allow only one handler.  I know Randal mentioned it once,
 but IIRC it was 2+ years ago...

 FWIW

 --Geoff





Re: Another way to perhaps do this......

2001-10-01 Thread Ken Williams



Gerald Richter [EMAIL PROTECTED] wrote:

 Wouldn't it be better to subclass Apache::SSI instead of
 HTML::Embperl::Syntax::SSI ?  That part of it would be really easy - the
 hard part would be actually implementing the OAS directive actions.



 If you really only want to do SSI, then subclassing Apache::SSI is of
 course the easier and better way to go. If you already use Embperl or
 want the features of EmbperlObject together with SSI, extenting
 HTML::Embperl::Syntax::SSI offers far more possibilities

Yes, absolutely - I wasn't sure whether the OP was looking for standalone 
SSI interpreting and extending, or whether he was going to use it in 
conjunction with something like Embperl.

 -Ken




Re: Another way to perhaps do this......

2001-09-29 Thread Ken Williams

Wim  Steven,

Wouldn't it be better to subclass Apache::SSI instead of 
HTML::Embperl::Syntax::SSI ?  That part of it would be really easy - the 
hard part would be actually implementing the OAS directive actions.


Wim Kerkhoff [EMAIL PROTECTED] wrote:
 Steven Boger wrote:

 I've been netsearching for hours. It's time to beg for help...

 My apache has a hacked mod_include that has a new directive, OAS:

 !--OAS
 SETUP=www.realmedia.com/Samples/lx.shtml@TopLeft,TopRight,BottomLeft,
 BottomRight--

 !--OAS AD=BottomRight--

 Can I somehow run those directives right from mod_perl

 Well... Since I've been spending several hours looking at the
 HTML::Embperl::Syntax::SSI module (Embperl.v2), I'm going to suggest
 that you might be able to extend Embperl's SSI syntax to do what the
 mod_include hack does.  This means that can parse the directive, let OAS
 do its thing, and at the same time have direct access to the request
 object...

 But then, I know squat about OAS and what it does, so this may not be
 all that feasible :-)

 Wim





Re: Apache-Roaming with Netscape-4-72

2001-09-19 Thread Ken Williams



Ted Sariyski [EMAIL PROTECTED] wrote:
 /home/web/roaming/.htaccess: Invalid command 'tsariysk:ZJbPFKHxDasnx',
 perhaps mis-spelled or defined by a module not included in the server
 configuration

It looks like you've confused the .htaccess and .htpasswd files.


 PerlModule Apache::Roaming
 Location /roaming/
 limit GET PUT MOVE HEAD DELETE
   /Limit
   PerlHandler Apache::Roaming-handler
   PerlTypeHandler Apache::Roaming-handler_type
   AuthType Basic
   AuthName Roaming User
   AuthUserFile /home/web/roaming/.htaccess
   require valid-user
   PerlSetVar BaseDir /home/web/roaming
 /Location

This is unrelated, but that Limit/Limit block is useless.  You
should get rid of it.





Re: Info required

2001-09-06 Thread Ken Williams

Hi,

It sounds like you want to read the source code. =)  Download mod_perl 
(or perhaps you already have) and read the source to Apache.pm, 
mod_perl.pm, and so on, until you understand everything you want to.  Be 
warned, it's not easy reading.

There aren't many documents describing the internals of mod_perl, because 
the internals are subject to change, and the user generally shouldn't be 
concerned with what's going on there (unless they want to read the 
source).

Murugan K [EMAIL PROTECTED] wrote:

 Hi
 In the CGI  environment ,
 After getting the request from the client  , based on the request
 the web server will load the cgi2perl  module   ( may be someother
 name)  to act as interface between perl and Webserver.  The cgi2perl
 will get the data from perl interpreter and give back to web server.
 This is the way it will work in cgi environment . The cgi2perl module
 will use the webserver API functions to interact with webserver.

 Like that , i want to understand how internally mod_perl is working
 apart from generic explanations. Where to get all those informations.

 Thanks in advance.

 Regards
 K.Murugan







Re: memory leaking with closures

2001-09-06 Thread Ken Williams


___cliff rayman___ [EMAIL PROTECTED] wrote:

 Alex Krohn wrote:

 Hi,

 With this simple test script:

 print Content-type: text/html\n\n;
 my $var = 'x' x 50;

 our $var = 'x' x 50;


 my $sub = sub { my $sub2 = sub { $var; }; };
 print Done\n;

 $var does not get freed, and the process grows each request. Has anyone
 seen this sort of behavior and have any ideas/workarounds (besides don't

 yes.  this is the documented behavior for closures.  the anonymous sub
 must have it's own copy of $var which happens to be 500k plus perl
 overhead on each invocation.

I think the problem is that $var doesn't get freed even when $var and
$sub and $sub2 have all gone out of scope.  That's a perl bug for which I
can fathom no workaround.

If any of those variables are still in scope, then of course $var can't
get freed.

 -Ken



Re: Apache::Request cookie handling methods?

2001-09-01 Thread Ken Williams

[EMAIL PROTECTED] (princepawn) wrote:
p.209 of the Eagle Book states that Apache::Request has some
experimental cookie-handling functions. However, neither perldoc
Apache or perldoc Apache::Request has the word cookie anywhere in
their body.

The cookie-handling stuff is called Apache::Cookie.


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



Re: OT: placeholders and DBI

2001-09-01 Thread Ken Williams

On Sat, Sep 01, 2001 at 02:38:05PM -0500, Mike808 wrote:
 ryc wrote:
  ... I am having a problem with DBI (or the db) escaping '\n'
  characters so when they are inserted into the database they become '\\n'
  (ie a '\' followed by 'n').
 
  Does anyone have advice on how this could be done while still using
  placeholders so I dont need to prepare the query more than once?
 
$sql .= '\Q$text\E'

Ack, no!  This is for escaping characters for use in a regular
expression, not in a database query.

Besides, the question was about how to use placeholders, not how to
embed a data string directly into an SQL query.  It's far better to
use placeholders, especially if you're using a database like Oracle
that supports them natively, providing a huge performance boost.

 -Ken



Re: $r-args()

2001-08-29 Thread Ken Williams

[EMAIL PROTECTED] (Rasoul Hajikhani) wrote:

Robert Landrum wrote:
 
   Which should solve your problems (I think).
 
 I am affraid it did not work. I have no problem reading the data in the
 current handler, but right after redirect, which is also required to
 read the data, I loose all the POSTED data.
 
 Performing a redirect causes posted data to be discarded. 

Did not find that in docs! maybe should pay more attention :(

You'll find the relevant material in the HTTP/1.1 docs:

  http://www.cis.ohio-state.edu/cgi-bin/rfc/rfc2068.html


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



Re: mod_perl memory consumption

2001-08-28 Thread Ken Williams

[EMAIL PROTECTED] (Perrin Harkins) wrote:
It sounds like you have some data structure which you are adding to and
never clearing out.  One thing to be careful of is the MySQL DBI driver.
The last time I used it, it fetched all returned rows into memory.  With a
large result set, that could take up tons of RAM.

Right, that sounds like the culprit.  Miroslav, see the 'mysql_use_result'
parameter in 'perldoc DBD::mysql', which will let you store the result
in a mysql server table rather than in client memory.


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



Re: PerlModule Error

2001-08-23 Thread Ken Williams

[EMAIL PROTECTED] (Rasoul Hajikhani) wrote:
  use lib qw(...);. I have tried declaring:
  use MY::Perl::Control::WebAccess; in my startup.pl, with the same

Here it is:

Undefined subroutine My::Perl::Control::WebAccess::handler called.

Looks like you need to check the capitalization on 'MY'.

By the way, using the MY:: namespace isn't the greatest idea in the
first place, because the MY:: namespace is used by MakeMaker during
modules' installation process.  I'm sure it's not causing a problem
here, but it can at least create confusion in the mind.


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



Re: configuration (or install) problems

2001-08-04 Thread Ken Williams

[EMAIL PROTECTED] (allan) wrote:
!--mod_perl-1.26 on apache_1.3.20 on mac osX (10.0.4)--

i am trying to get mod_perl up and running om mac osX.
i am quite sure i have installed correctly, at least according to the
99.23% okay test-report (see below).

It's not installed correctly - the PerlModule error you're getting
indicates that mod_perl isn't compiled into the server.

There's been discussion of building mod_perl on the [EMAIL PROTECTED]
list, whose archives you can find at http://lists.perl.org/ .

I don't think I've ever seen the particular src.t problem you're seeing.


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



Re: More stuff not working with conversion to modperl?

2001-07-31 Thread Ken Williams

Hi John,

[EMAIL PROTECTED] (John Buwa) wrote:
I am trying to finish up my scripts conversion to mod perl and here is a 
routine i truely do not undestand why it is not working.

You really have to turn on 'use strict'.  It looks like both $i and
$line are undeclared variables.  Also, why do you chomp($line) and then
put the newline back on?  You should just leave it as it is.

Also, you don't lock MYFILE when you read it, so you could be reading
garbage input.


if (($user_matched == 1)  ($pass_matched == 1)) {
$i = 1; #init count variable
open(MYFILE, mail/$user); #open users mail box to read in
@OLDMAIL = MYFILE;
close(MYFILE);
open(NEW, mail/$user); #open new copy of users mail box
flock (NEW, LOCK_SH);
seek (NEW, 0, 0); # Rewind
foreach $line (@OLDMAIL) {
chomp($line);
unless ($i == $msgnum) {
print NEW $line\n;
}
$i++ #increment cnt
   }#End of foreach loop
flock (NEW, LOCK_UN);#release flock
close(NEW);#close new mail file
 
}#end of it



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



Re: BOF?

2001-07-19 Thread Ken Williams

[EMAIL PROTECTED] (brian moseley) wrote:

On Tue, 17 Jul 2001, Ask Bjoern Hansen wrote:

 Sunday evening where?

sounds like the hotel bar is the only real option. i'll be
there 8.30-9pm i guess.


Since it seems like Sunday night is the overwhelming favorite, I'll just
have to meet up with y'all as-catch-can throughout the week.  See you soon!


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



Re: Problem Locating DB_File.PM at startup of perl script

2001-07-18 Thread Ken Williams

Hi James,

The loadable object is not the .pm file, it's the binary compiled
object file that DB_File.pm needs to bootstrap.  Sounds like you need to
reinstall the module.


[EMAIL PROTECTED] (James McKim) wrote:
Hi all,

I've run into a very frustrating problem. I'm getting the old Can't
locate loadable object for module... error, yet the file does exist in
the @INC path. Here's some system output:

---

[Wed Jul 18 12:18:04 2001] pickcity.cgi: Can't locate loadable object
for module DB_File in @INC (@INC contains:
/usr/local/lib/perl5/5.6.1/i686-linux /usr/local/lib/perl5/5.6.1
/usr/local/lib/perl5/site_perl/5.6.1/i686-linux
/usr/local/lib/perl5/site_perl/5.6.1 /usr/local/lib/perl5/site_perl .)
at /var/pickcity/htdocs/pickcity.cgi line 12
[Wed Jul 18 12:18:04 2001] pickcity.cgi: Compilation failed in require
at /var/pickcity/htdocs/pickcity.cgi line 12.
[Wed Jul 18 12:18:04 2001] pickcity.cgi: BEGIN failed--compilation
aborted at /var/pickcity/htdocs/pickcity.cgi line 12.
[root@localhost DB_File]# ls
/usr/local/lib/perl5/5.6.1/i686-linux/DB_File.pm
/usr/local/lib/perl5/5.6.1/i686-linux/DB_File.pm
[root@localhost DB_File]#
--

Anyone have any ideas as to why perl can't seem to find the file
eventhough the system, clearly, can?

James



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



Re: please post the URLs for your TPC talks

2001-07-17 Thread Ken Williams

[EMAIL PROTECTED] (Stas Bekman) wrote:
Folks, it'd be really nice to do some homework and read the conference
papers ahead I'll take me some 24 hours to get to SD from Singapore, so I
could use this time to learn ahead and allow me to spend more time peer
networking at the conference. Can you please post the URLs for your talks?
Not only mod_perl, but any...

You asked for it ... ;-)

   http://mathforum.com/~ken/categorize/001.html

(These are the slides from YAPC, I need to revise them a little for TPC.)


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



Re: please post the URLs for your TPC talks

2001-07-17 Thread Ken Williams

[EMAIL PROTECTED] (Erik Arneson) wrote:
Ken,

This looks very awesome.  When are you holding your talk?  I want to
make sure and see it.

I'll be speaking at 2:15 on Wednesday in Grande Ballroom B.  (Good thing
I checked, because I thought I was on Friday!)


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



Re: Post processing Perl output through PHP

2001-07-16 Thread Ken Williams

[EMAIL PROTECTED]'s message:
 I'm not entirely sure if I'm getting what you're asking here - I get the
 impression you want the Perl program to call the php script, such as
 http://localhost/script.php3 and get the results from that script which you
 then push into  the results of your perl script, correct? The reason  I'm
 not sure is the part where you create a bunch of files in your tmp directory
 and then process those. Are you saying you're getting perl  to create PHP
 code, and getting Apache to process those, and then returning the results,
 or that you're getting perl to create a batch command essentially?

This is the problem.. I'm not just fetching a local php page, I am actually
using Perl to generate a bunch of PHP commands, which I then want Apache
to process on the way back to the client. Until a stable 2.0 Apache is
out and I can use SetOutputFilter, I am left with (what I think is the only
choice left...) creating a temporary file, under DOCUMENT_ROOT, putting the
generated PHP into it, using LWP or friends to fetch that page throuh Apache,
which will then parse the PHP with mod_php, and send that output back to
the client via 'print $fetched_contents;'

You'll be happier, and the code will run faster, if you use an Apache
subrequest instead of a full-blown LWP request.  If you're not
familiar with subrequests, look up $r-lookup_uri() and
$r-lookup_file() in the mod_perl docs and/or the Eagle book.


-Ken Williams
 The Math Forum
 [EMAIL PROTECTED]



Re: modperl install on osx - help

2001-07-16 Thread Ken Williams

Christian,

You should get the latest Apache, 1.3.20, instead of the old 1.3.14.
Also try removing the 'USE_APACI=1' flag from your build line.  That
combo works for me under OS X 10.0.4.  Perhaps it would work with
USE_APACI=1 in there too, but I haven't tried.


Christian Wattinger's message:

im at the end of my wisdom here,
i try to install on mac osx following the advice
from 
http://perl.apache.org/guide/install.html#A_Summary_of_a_Basic_mod_perl_In

i dont get very far with it and i know still little about unixy stuff.

im desperate because i need this mod_perl to work quickly
(i tried  tenon iTools but their apache configs with EXPAT enabled =
conflict! and its expensive too...)

well i post below what i get, help is very welcome!

thanks
christian
-

[cable-ggar40-162:/usr/src/mod_perl-1.26] root# perl Makefile.PL
APACHE_SRC=../apache_1.3.14/src DO_HTTPD=1 USE_APACI=1 EVERYTHING=1


-Ken Williams
 The Math Forum
 [EMAIL PROTECTED]



BOF?

2001-07-14 Thread Ken Williams

Yo,

I just noticed that there's no mod_perl BOF listed at 
  http://conferences.oreillynet.com/cs/os2001/pub/10/bofs.html .
Is one scheduled?  If not, let's get one together.


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



Re: BOF?

2001-07-14 Thread Ken Williams

[EMAIL PROTECTED] (brian moseley) wrote:

On Sat, 14 Jul 2001, Richard Dice wrote:

 Which opening night would that be?  I'm not getting in
 until Tuesday noon. At the same time, I'm recovering at
 the moment from last night's piss-up... I don't think
 I'll need a repeat anytime soon.  Still, I'm sure the
 company would be fun. :-)

umm, the night before the first day of tutorials. i'm sure
people will be getting together every night. but it was
pretty cool last year for all the mp folks to show up at one
place that first night.

I'll arrive sometime on Monday, ready to piss.  (oh, wait...)


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



Re: [aliasing] Using mod_perl handlers for max speed?

2001-07-13 Thread Ken Williams

Heh - you're on the wrong track.  The whole quote below is part of a
double-quoted string, and each backslash is just to put a literal $ into
the code.  It will be eval'ed later.


[EMAIL PROTECTED] (raptor) wrote:
!!! Is it possible to have  reference on the left side of the equation !!!
I've tried this to alias HASH :) but didn't succeeded...
sub {
 my \$hash = shift; # $_[0] is  \%myhash
};

Yes I know that there is aliasing : my *hash = \%{$hashref}..
And I see that here u use  : \$r-blah
Never mind it is cute construct anyway. Do U have any benefit in speed
using it in this way ?!

PS. didn't u think that there must finaly alias keyword in perl
=
iVAN
[EMAIL PROTECTED]
=


 Files ~ (hello\.bench)
 Perl
# ModPerl Handler
  package Apache::bench;
  sub handler {
my(\$r) = shift;
\$r-content_type('text/html');
\$r-send_http_header();
\$r-print('Hello ');
\$r-print('World');
200;
  }
1;
 /Perl
 SetHandler perl-script
 PerlHandler Apache::bench
 /Files




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



Re: tying STDIN/STDOUT

2001-07-13 Thread Ken Williams

[EMAIL PROTECTED] (brian moseley) wrote:

hmm... i think i have a similar question.

i want to prevent people from writing data directly to the
apache connection and instead force them to use an object i
provide for generating output. they can call $obj-print()
directly, but i also want them to be able to use 'print
foo\n' as is standard in handlers and registry scripts.

seems like i want to untie STDIN and STDOUT as per below..
but then how do i attach those handles to my object's print
method? is tieing the correct approach, or is there some
other kind of filehandle magic i can use?

Tying is probably the way to go.  You can check out Apache::Filter for
an example of how to tie STDOUT.


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



Re: Using mod_perl handlers for max speed?

2001-07-11 Thread Ken Williams

[EMAIL PROTECTED] (Philip Mak) wrote:
Does this mean that if there's a heavily used script on my system that
needs to be VERY fast, then it may be worth making it into a mod_perl
handler? What are the caveats of using mod_perl handlers instead of normal
scripts?

The basic idea is this: with a handler, you're adding new capabilities
to the server itself.  With a script (CGI or Registry or otherwise),
your functionality becomes a resource outside the server, and the server
must check that resource, manage it, and cater to its interface needs.
How aggressively the server manages reloading, etc. varies from one
scheme to another, but that additional stuff is the reason Registry
scripts are usually slower than handlers.

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



Re: Filter access to Files on Apache

2001-07-09 Thread Ken Williams

[EMAIL PROTECTED] (Thomas Bach) wrote:
perhaps it is off-topic (sorry for that, but i hope that somebody of you 
can help me), but somehow i wish to have a solution with precompiled perl 
such as mod_perl or ... everything else which fits to my needs.

I want to filter every access of for example all .jpg-files on my apache 
for autentication purposes. I  use my own cookie-based authentication 
mechanisms.
So one solution i had was to add a handler

Action auth authent.pl
AddHanlder auth jpg

and in the authent.pl use something like a internal redirection. But the 
only way i know to get this internal redirection is the following:

open(DATEI, ...)
print while (DATEI)
close(DATEI)

If you want to directly send a file, use:

   open(DATEI, ...)
   $r-send_fd(DATEI)
   close(DATEI)

You can do an internal redirect using subrequests, if you want.  See
$r-lookup_uri().

But I'm not sure why you need to redirect just to authenticate.  Can't
you just deny access if authentication fails, and allow it if it
succeeds?


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



Re: Filter access to Files on Apache

2001-07-09 Thread Ken Williams

[EMAIL PROTECTED] (Thomas Bach) wrote:
At 11:17 09/07/01 -0500, you wrote:
If you want to directly send a file, use:

open(DATEI, ...)
$r-send_fd(DATEI)
close(DATEI)

You can do an internal redirect using subrequests, if you want.  See
$r-lookup_uri().

what kind of object is $r ?
CGI?

It's the Apache request object.  See 'perldoc Apache' or 'perldoc mod_perl'.

But I'm not sure why you need to redirect just to authenticate.  Can't
you just deny access if authentication fails, and allow it if it
succeeds?


yes, this is what i want to do, but how do I make this over an apache 
handler (or sth. similar)?
sorry, I'm not that deep in this stuff, but I hope once I'll get it.

It sounds like perhaps you should take a look at the book Writing
Apache Modules with Perl and C from O'Reilly.  There are many ways you
could do this, and a book like that will give you a sense of the issues
involved.


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



Re: Questions Concerning Large Web-Site

2001-06-11 Thread Ken Williams

[EMAIL PROTECTED] (Ron Beck) wrote:
Is there a good tutorial or book on the subject of constructing Perl
modules?  I too have done some of this and would like to create actual
modules instead of required subroutines.

I've written one, at http://www.mathforum.com/~ken/perl_modules.html

It's general-purpose, not Apache or mod_perl specific.


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



Re: Practical examples of mod_perl Method handlers?

2001-06-05 Thread Ken Williams

[EMAIL PROTECTED] (Randy J. Ray) wrote:
Are there any CPAN modules for Apache that are examples of writing a
method handler? The docs in the manpage, the book, and the mod_perl
guide are pretty much all the same (brief) text. A good example would
help a great deal. Thanks.

Apache::AuthCookie uses method handlers.  Several subclasses of it also
exist, like Apache::AuthTicket, Apache::AuthCookieDBI, and whatever DIY
module you build to use AuthCookie itself.


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



Re: undef an array

2001-06-01 Thread Ken Williams

[EMAIL PROTECTED] (Scott Alexander) wrote:
in my code I have

my @upper_id ;

during the code I pass the array by reference to a sub routine and push
values onto it.

push @{$upper_id}, $row[0] ;

Some of my code I have arrays of strings or ints.  I might add 100 or
more items to each array. The strings could be 50 characters long.  What
happens to the array at the end?  Should I have a

undef @upper_id ;
 at the end ?

If I don't have this does it mean the array just stays in memory until
the child is stopped?

That all depends on where the original array declaration is.  If it's in
some block whose scope is limited to the request, it'll get properly
cleaned up.  If it's got file-scope or something undesirable like that,
you'll have to clean it up manually - or better, just fix its scoping.

BTW, I usually prefer '@array=();' to 'undef @array;', because I like to
let Perl handle the memory allocation/deallocation.  If memory is tight
though, then I suppose you'll do what you have to do.


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



Re: undef an array

2001-06-01 Thread Ken Williams

[EMAIL PROTECTED] (Tom Mornini) wrote:
On Fri, 1 Jun 2001, Scott Alexander wrote:
 in my code I have

 my @upper_id ;

 during the code I pass the array by reference to a sub routine and
 push values onto it.

 push @{$upper_id}, $row[0] ;

This is odd syntax! Why not just:

push @upper_id,$row[0];

I hope this isn't some sort of soft reference.

Scott's is correct - he said the push() happens inside a different
subroutine, and the array is passed to it by reference.

Could be shortened to 'push @$upper_id, $row[0];', but no biggie.


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



Re: Content-Disposition to change type and action?

2001-05-29 Thread Ken Williams

[EMAIL PROTECTED] (Steve Piner) wrote:
My suggestion is to use mod_rewrite to create a mapping so that the
actual file name doesn't matter. I have a rule in the Apache conf file:

RewriteRule ^/reports/ /bin/report.pl [PT]

So going to http://www.mysite.com/reports/foo.csv?param1=val1 would be
the same as going to http://www.mysite.com/bin/report.pl?param1=val1
except if the page is to be downloaded, the browser will use the name
foo.csv.

That doesn't solve the problem, though.  The type of file is chosen in a
form, and the action of the form is already set by the time that form is
loaded.  I assume Jay doesn't want to use Javascript to change the
action dynamically.

My own preference would be to post to some generic script which
redirects to another URL with the desired filename extension and proper
disposition headers.


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



Re: macintosh osX - mod_perl install problems - head - HEAD - setenv

2001-05-27 Thread Ken Williams

[EMAIL PROTECTED] (allan) wrote:
one thing: i have discovered that another problem i have had since
upgrading to perl 5.6.1 might be interfering with the one in this topic
(im not sure though -  it is concerning setenv)

look at this new fresh terminal window:

[localhost:~] aju% which head
/usr/local/bin/head
[localhost:~] aju% which HEAD
/usr/bin/HEAD
[localhost:~] aju% setenv LC_ALL C
[localhost:~] aju% setenv LANG en_US
[localhost:~] aju% which head
/usr/bin/head
[localhost:~] aju% which HEAD
/usr/local/bin/HEAD

Criminy!  I don't understand this one bit.  But if you do:

  cd /usr/local/bin
  mv HEAD LWP-HEAD

then you should have it out of the way for good.  At least until you try
to upgrade LWP. =)

maybe i should just start all over, reformat and everything ...?


No, that's probably a bit too drastic if you've got anything of
consequence on the disk.


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



Re: macintosh osX - mod_perl install problems

2001-05-25 Thread Ken Williams

[EMAIL PROTECTED] (allan) wrote:
im aware of the head/HEAD problem that comes with LWP on mac osX and
have therefore copied a binary head that ken williams sent me into
/usr/bin and moved the lwp head into /usr/local/bin.

Looks like that problem still isn't fixed, as shown by the following
error message:

Usage: head [-options] url...
-m method   use method for the request (default is 'HEAD')

You may have a different PATH than I do, or different capitalization on
the binary files.  The upshot is that when you run the 'head' command,
it *must* run the /usr/bin/head program I sent you and not LWP's 'HEAD'
script.  Here's a transcript from my shell, what does yours say?

   [localhost:~] ken% which head
   /usr/bin/head
   [localhost:~] ken% which HEAD
   /usr/local/bin/HEAD


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



Re: These are probably simple questions.

2001-05-25 Thread Ken Williams

[EMAIL PROTECTED] (Bird Lei) wrote:
If I upgraded Perl, do I need to recompile mod_perl?


Yes.

And if I have multiple Perls on a machine (eg 5.6.0 and 5.6.1. maybe in 
some non-standard directories), how can I tell mod_perl which one to use?

Whichever one you compile mod_perl with:

  /usr/bin/perl5.6.0 Makefile.PL EVERYTHING=1
  
   versus
  
  /usr/bin/perl5.6.1 Makefile.PL EVERYTHING=1


Where is the place to check for Perl's config such as @INC?

Either through command-line 'perl -V', or through Apache::Status in a
web browser.


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



Re: mod_perl and NES/iPlanet

2001-05-23 Thread Ken Williams

[EMAIL PROTECTED] (Niral Trivedi) wrote:
mod_perl can not be used with NES or iPlanet web server, right?

We are so much screwed up here with iPlanet but we have to use that for
some other reasons.. So, we were exploring the possibilities..

It depends - if you need to run iPlanet as your main server but could
run an Apache process as a backend using a proxy, then you could do
fine.  If you're forbidden from running Apache at all, you're out of
luck.


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



RE: Connection to MySQL DB fails when mod_perl enabled...

2001-05-21 Thread Ken Williams

[EMAIL PROTECTED] (Jonathan M. Hollin) wrote:
[EMAIL PROTECTED] (Mike Cameron) wrote:
:: how bout adding a 'or die DBI-errstr' to the above line to find
:: out whats
:: happening.

Hmm...  Tried that, it returns nothing!!! :-(

This is suspicious.  The connect() is definitely where the error is
happening given what you wrote earlier.  Try making sure, change it to:

use DBI();
$driver = mysql;
$dsn = DBI:$driver:database=shapeshifter;host=localhost;
$dbh = DBI-connect($dsn, dbusrname, dbpassword)
  or die Error: $DBI::errstr;

(include the whole string there)


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



RE: Connection to MySQL DB fails when mod_perl enabled...

2001-05-21 Thread Ken Williams

[EMAIL PROTECTED] (Jonathan M. Hollin) wrote:
:: This is suspicious.  The connect() is definitely where the error is
:: happening given what you wrote earlier.  Try making sure, change it to:
:: 
:: use DBI();
:: $driver = mysql;
:: $dsn = DBI:$driver:database=shapeshifter;host=localhost;
:: $dbh = DBI-connect($dsn, dbusrname, dbpassword)
::   or die Error: $DBI::errstr;

Done this - failed!

What does 'failed' mean?  What was the error?  That's the point, you
have to see the particular error string, starting with Error:, to find
out what's happening.  


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



RE: Connection to MySQL DB fails when mod_perl enabled...

2001-05-21 Thread Ken Williams

[EMAIL PROTECTED] (Jonathan M. Hollin) wrote:
:: Tom is saying that your error message should actually include the string:
:: 'Error: '. I'm wondering the same thing, what did ~that ~ error
:: message say?

That's my point.  I DO have the or die code in my script - it hasn't
changed the message reported in error.log.  Believe me guys, I'm as confused
as you are.

Okay, then that's the problem.  It's not running the script you think
it's running.  If you don't see 'Error:' in the error log, then you
could change that script all day and your changes will never have any
effect.  

So either you're just running the wrong script, or the script has gotten
cached under Apache::Registry and it's not noticing the latest version
on disk.


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



RE: Connection to MySQL DB fails when mod_perl enabled...

2001-05-21 Thread Ken Williams

[EMAIL PROTECTED] (Jonathan M. Hollin) wrote:
I'm probably going to have to forfeit mod_perl after all.  :-(

Okay, last idea: you say you can connect to mysql from the command line,
from regular CGI, and from PHP.  I'm guessing that in all of those
situations, you're acting as the same user (win2k user, not mysql user).
However, under mod_perl you'll be acting as whatever user your web
server runs as.  That's probably the only real difference between
mod_perl and the other situations.

So if you can become that user and try connecting to the database,
perhaps you can get more insight into the problem.


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



RE: Connection to MySQL DB fails when mod_perl enabled...

2001-05-21 Thread Ken Williams

[EMAIL PROTECTED] (Jonathan M. Hollin) wrote:
:: Okay, last idea: you say you can connect to mysql from the command line,
:: from regular CGI, and from PHP.  I'm guessing that in all of those
:: situations, you're acting as the same user (win2k user, not mysql user).
:: However, under mod_perl you'll be acting as whatever user your web
:: server runs as.  That's probably the only real difference between
:: mod_perl and the other situations.
::
:: So if you can become that user and try connecting to the database,
:: perhaps you can get more insight into the problem.

I would like to try that (anything to get this working).  Er...  how do I do
that?

Under win2k, I have no idea.  Under unix, you'd use su or a similar
identity-switching mechanism.  You'll probably have to find a win2k
person to help with that.

Let me also gently suggest that you should take this off-list, as there
have been a lot of messages on your topic already.  


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



Re: Building on Darwin (Mac OS X)

2001-05-15 Thread Ken Williams

[EMAIL PROTECTED] (David Ranney) wrote:
I too tried compiling statically on OS X, and got similar error messages. I
did however compile and install the DSO against the pre-installed Apache,
and was able to run some basic test Registry scripts with no problems.

Still, it would be nice to be able to recompile at will. Hope you have luck
figuring out the problem.

I suppose if nobody has a known fix, this is a topic for the modperl-dev
list.  I'll move it over there.


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



Building on Darwin (Mac OS X)

2001-05-14 Thread Ken Williams

Hi,

I can successfully build on Darwin, but a couple problems remain.
Although I can compile Apache using APACI, and I can compile
apache/mod_perl with manual configuration, I can't compile
apache/mod_perl with APACI.   Here's a transcript (apache was built with
exact same APACI args):


---
[localhost:~/Downloads/mod_perl-1.25] ken% perl Makefile.PL EVERYTHING=1 USE_APACI=1 
APACI_ARGS='--with-layout=Darwin'
Will configure via APACI
Enter `q' to stop search
Please tell me where I can find your apache src
 [] /Users/ken/src/apache_1.3.19/src
Configure mod_perl with /Users/ken/src/apache_1.3.19/src ? [y] 
Shall I build httpd in /Users/ken/src/apache_1.3.19/src for you? [y] 
cp apaci/Makefile.libdir /Users/ken/src/apache_1.3.19/src/modules/perl/Makefile.libdir
cp apaci/Makefile.tmpl /Users/ken/src/apache_1.3.19/src/modules/perl/Makefile.tmpl

[snip]

env LD_RUN_PATH=/System/Library/Perl/darwin/CORE cc -c -I.. 
-I/System/Library/Perl/darwin/CORE -I../os/unix -I../include   -DDARWIN -DMOD_PERL
-DUSE_PERL_SSI -g -pipe -pipe -fno-common -DHAS_TELLDIR_PROTOTYPE -fno-strict-aliasing 
-DUSE_HSREGEX -DNO_DL_NEEDED -g -pipe -pipe -fno-common
-DHAS_TELLDIR_PROTOTYPE -fno-strict-aliasing `../apaci` ap_getpass.c
ap_getpass.c: In function `ap_getpass':
ap_getpass.c:191: warning: assignment makes pointer from integer without a cast
env LD_RUN_PATH=/System/Library/Perl/darwin/CORE cc -c -I.. 
-I/System/Library/Perl/darwin/CORE -I../os/unix -I../include   -DDARWIN -DMOD_PERL
-DUSE_PERL_SSI -g -pipe -pipe -fno-common -DHAS_TELLDIR_PROTOTYPE -fno-strict-aliasing 
-DUSE_HSREGEX -DNO_DL_NEEDED -g -pipe -pipe -fno-common
-DHAS_TELLDIR_PROTOTYPE -fno-strict-aliasing `../apaci` ap_md5c.c

[snip]

./gen_test_char test_char.h
env LD_RUN_PATH=/System/Library/Perl/darwin/CORE cc -c -I.. 
-I/System/Library/Perl/darwin/CORE -I../os/unix -I../include   -DDARWIN -DMOD_PERL
-DUSE_PERL_SSI -g -pipe -pipe -fno-common -DHAS_TELLDIR_PROTOTYPE -fno-strict-aliasing 
-DUSE_HSREGEX -DNO_DL_NEEDED -g -pipe -pipe -fno-common
-DHAS_TELLDIR_PROTOTYPE -fno-strict-aliasing `../apaci` alloc.c
alloc.c: In function `spawn_child_core':
alloc.c:2291: `STDOUT_FILENO' undeclared (first use in this function)
alloc.c:2291: (Each undeclared identifier is reported only once
alloc.c:2291: for each function it appears in.)
alloc.c:2297: `STDIN_FILENO' undeclared (first use in this function)
alloc.c:2303: `STDERR_FILENO' undeclared (first use in this function)
make[4]: *** [alloc.o] Error 1
make[3]: *** [subdirs] Error 1
make[2]: *** [build-std] Error 2
make[1]: *** [build] Error 2
make: *** [apaci_httpd] Error 2
[localhost:~/Downloads/mod_perl-1.25] ken% 
---

Pointers are appreciated.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
osname=darwin, osvers=1.0, archname=darwin
uname='darwin negative 1.0 darwin kernel version 1.3: wed jan 3 16:05:51 pst 2001; 
aramesh:buildobjrelease_ppc power macintosh powerpc '
config_args='-ds -e -Dprefix=/usr -Dccflags=-g  -pipe  -Dldflags='
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
useperlio=undef d_sfio=undef uselargefiles=define 
use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
cc='cc', optimize='-O3', gccversion=Apple DevKit-based CPP 6.0alpha
cppflags='-g -pipe -pipe -fno-common -DHAS_TELLDIR_PROTOTYPE -fno-strict-aliasing'
ccflags ='-g -pipe -pipe -fno-common -DHAS_TELLDIR_PROTOTYPE -fno-strict-aliasing'
stdchar='char', d_stdstdio=undef, usevfork=true
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, usemymalloc=n, prototype=define
  Linker and Libraries:
ld='cc', ldflags =''
libpth=/usr/lib
libs=-lm -lc
libc=/System/Library/Frameworks/System.framework/System, so=dylib, 
useshrplib=true, libperl=libperl.dylib
  Dynamic Linking:
dlsrc=dl_dyld.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags='-bundle -undefined suppress'


Characteristics of this binary (from libperl): 
  Compile-time options: USE_LARGE_FILES
  Built under darwin
  Compiled at 02/16/01 17:02:42
  @INC:
/System/Library/Perl/darwin
/System/Library/Perl
/Library/Perl/darwin
/Library/Perl
/Library/Perl
/Network/Library/Perl/darwin
/Network/Library/Perl
/Network/Library/Perl
.



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



Re: Building on Darwin (Mac OS X)

2001-05-14 Thread Ken Williams

[EMAIL PROTECTED] (Charlie Garrison) wrote:
G'day,

I can successfully build on Darwin, but a couple problems remain.

Why not use the mod_perl that was installed with the system? You'll 
need to add the modules to your httpd.conf (see list archives for 
more details, search for 'Installation on MAC OS X').


I do a lot of recompiling and reconfiguring of mod_perl and various
Apache:: modules, so it's pretty important that I figure out how to get
compilation  installation working properly.  I also just want to debug
whatever was going wrong, so it can get fixed.

I was under the impression from your original post in that thread that
you were talking about the old Mac OS X Server system, but I see now
from poking around that it was Darwin after all.

So perhaps I'll try compiling just the mod_perl DSO and see whether that
works.  I've never gone that route before because of the historic DSO
problems with mod_perl.


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



Re: looking for a functin to move %fdat to the symbol table..

2001-05-10 Thread Ken Williams

[EMAIL PROTECTED] (jason n perkins) wrote:
php has a function called extract which takes an array (no distinction
between arrays and hashes in php. in this case in perl, it'd actually
be a hash). extract takes the key values of the array (and optionally
prepends a user specified prefix to each of the values to avoid
clobbering other values in the symbol table), sets each of them up as a
variable with that name and sets the variable's value equal to the
value of that associated key in the hash. the beauty of extract comes
into play when you want to use each of the key/value pairs in the
array. instead of setting them up one at a time, pass the array to
extract and voila, you have all of the key/value elements available as
variables. if my description is too unclear, you can check the extract
functions info at http://www.php.net/manual/en/function.extract.php.

does embedded perl sport a similar function?

You do know about the built-in Perl function 'each', right?

As others have pointed out, what you're asking for can be done, but it
shouldn't be done.  You can almost always write much much cleaner code
by dealing with the hashes as hashes and not converting all its parts to
individual scalar variables.  I've seen a lot of [bad] code like this:

  $name = $data{name};
  $address = $data{address};
  $phone = $data{phone};
  
  $dbh-do(UPDATE users SET address='$address', phone='$phone'
WHERE name='$name');

It's much better (shorter, faster, safer) to let the hash do the work:

  $dbh-do(UPDATE users SET address=?, phone=? WHERE name=?, undef,
   @data{'address','phone','name'});

In addition, in a mod_perl environment you don't want any of your
data-carrying variables to be in the runtime symbol table.  Lexical
variables ('my') are much safer and guard against variables leaking out
of the scope you thought they were supposed to be in.


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



Re: Throwing die in Apache::Registry

2001-05-05 Thread Ken Williams

[EMAIL PROTECTED] (Matt Sergeant) wrote:
On Fri, 4 May 2001, Perrin Harkins wrote:
 on 5/4/01 9:28 AM, Mark Maunder at [EMAIL PROTECTED] wrote:
  I have an Apache::Registry script that is using XML::Parser. The
  parser throws a 'die' call if it encounters a parse error (Why?).
 
 Because it's an exception and the parser can't continue.
 
  I was handling this by putting the code in an eval block, but this
  no longer works since all Registry scripts are already in one huge
  eval block.
 
 It should still work.  An eval{} is scoped like any other block.  Maybe you
 have a typo?  Post your code and we'll look at it.

More likely is a b0rked $SIG{__DIE__} handler, like fatalsToBrowser. Yick.


If he's throwing a die, the randomness is probably going to make it hard
to track down the problem.  But there should be a 1 in 6 chance of
failure, so at least you can figure out the various distributions.

[Sorry, I'm teaching a probability class right now.]


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



Re: mod_perl subs defined, but don't exist? SOLVED mostly

2001-05-03 Thread Ken Williams

I can't follow this test case.  Your previous message had a test case,
but it was way too big.  Can you whittle this down into the smallest
possible program that demonstrates something you don't understand, and
post that?  My guess is that you'll figure out the problem in the
process, but if not, post it here.

By the way, I don't think you mean $My::Debacle::handler{CODE}.  If you
look closely, you'll see that it's just a regular hash entry.  I think
you mean *{$My::Debacle::{handler}}{CODE}.  That's the CODE component of
a symbol table entry.

If you have Effective Perl Programming, look on page 239.

I know this stuff is hard to spot when you've been banging your head
against it for days.  For that, I recommend Zen and the Art of
Motorcycle Maintenance.


[EMAIL PROTECTED] (will trillich) wrote:
okay, here was the problem.

package My::Debacle;

sub search {
# 
{
use CGI qw/:standard/;
my $form = join '',
map {
hidden(
-name = $_,
-value = $arg-{$_},
) . \n
}
grep(
$arg-{$_} and ($_ ne 'd') and ($_ ne 'go')
, keys %$arg
)
;
# 
}
# 
}

sub this { # ...
}
sub that { # ...
}
sub something_else { # ...
}
sub whatever_the_hell { # ...
}
sub handler { # ...
}

can you spot the problem?

with that, poof! $My::Debacle::handler{CODE} doesn't exist.
WHY?

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


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



[OT] Re: mod_perl subs defined, but don't exist? SOLVED mostly

2001-05-03 Thread Ken Williams

[EMAIL PROTECTED] (will trillich) wrote:
 sub search {
 # 
 {
 use CGI qw/:standard/;
 my   $form = join '',
 map {
 hidden(
 -name = $_,
 -value = $arg-{$_},
 ) . \n
 }
 grep(
 $arg-{$_} and ($_ ne 'd') and ($_ ne 'go')

as is, the functions that follow (top-level 'sub xyz {}') get
screwy. code disappears.

replace and with  and all is well. boggles my mind.


Well, as far as I can tell, the original code doesn't even compile
because there aren't enough arguments to grep().  That's why I couldn't
test it.  I suppose changing the precedence helped things out.  Perhaps
you should use the more explicit BLOCK version:

my $form = join '',
map 
  {
hidden(
-name = $_,
-value = $arg-{$_},
) . \n
  }
grep 
  {
$arg-{$_} and ($_ ne 'd') and ($_ ne 'go')
  }
keys %$arg;


with 'and' *{$My::Debacle::{handler}}{CODE} doesn't exist.

That's an illusion.  The truth is that with 'and' the code is checking
something completely different, or not working at all.

This is turning out to be pretty well off-topic for the mod_perl list,
so we should cease.


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



Re: CORE::format() and CORE::write() under 5.6.x

2001-04-30 Thread Ken Williams

[EMAIL PROTECTED] (Stas Bekman) wrote:
On Mon, 30 Apr 2001, Matt Sergeant wrote:
 On Mon, 30 Apr 2001, Stas Bekman wrote:
  cool, but this section in the guide was stating the CORE::format() doesn't
  work.  And it's still doesn't under mod_perl. So doesn't CORE::write().

 Right, but it would be nice to point to an alternative. The module is
 called Text::Reform, by the way.

True. Thanks.

Does it have any problems with working under mod_perl? looks like a pure
perl to me.


Damian claims to only ever write code in pure Perl.


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



Re: apache::registry + use strict curiosity

2001-04-26 Thread Ken Williams

Yes, exactly.  After the first run, $test got an entry in the symbol
table.  Not usually an issue in CGI perl. =)


[EMAIL PROTECTED] (Eric Kolve) wrote:
I found something a bit curious that I was wondering if someone could
explain. I have the following apache::registry script I called test.reg:

#!/usr/bin/perl
 
use strict;
if($test){
# do stuff
}
 
 
print qq|HTTP/1.1 200 OK\r\n|;
print HELLO WORLD\n\n;


I ran my server in single-user mode (httpd -X) and requested the page
which causes an internal server error because I didn't declare '$test'. 
I next commented out the three conditional lines:

#if($test){
# do stuff
#}

Then requested the page a second time, which executed just fine. I
uncommented those three lines and requested the page a third time, which
strangely enough actually works.  Registry stats pages to see if they
change and recompiles pages I believe.  So I am wondering why isn't an
exception raised on the third request about not declaring '$test'?  Did
the first request put '$test' in the symbol table?

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



Re: mac_check in eagle book

2001-04-15 Thread Ken Williams

[EMAIL PROTECTED] (Eric Kolve) wrote:
I was wondering if someone could explain to me why in the eagle book it
is necessary to perform 
an md5 twice before sending a mac_check to a user of a number of
fields.  I read in the mod_perl book that this is done 'to prevent
technically savy users from appending data to the @fields'. 

my $mac_check = md5_hex($secret,
md5_hex(join '', $secret, @fields));  


What I am wondering is, what situation would a user be able to append
data to the fields? I believe if you change only one bit of the data,
the mac will change, so I am a little confused.

This looks suspicious to me too.  Any hashing algorithm worth its salt
shouldn't have to be done twice.  And doing it twice may in fact expose
weaknesses in the algorithm (though I have no evidence to support this).

I'd suggest just this:

   my $mac_check = md5_hex join '', $secret, @fields;


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



ANNOUNCE: Apache::Filter 1.018

2001-04-08 Thread Ken Williams

The URL

http://www.mathforum.com/~ken/modules/archive/Apache-Filter-1.018.tar.gz

has entered CPAN as

  file: $CPAN/authors/id/K/KW/KWILLIAMS/Apache-Filter-1.018.tar.gz
  size: 24403 bytes
   md5: ac3bb8ab1bda2e247d35a1bb5ab33fe7


Changes since 1.017:

   Some fixes for the 'perl Makefile.PL' and 'make test' stages.  Fixes a
   problem for those who want to skip testing with a real httpd, and
   properly removes quotation marks from 'LoadModule' directives when
   building httpd.conf to use during 'make test'.

   No changes were made to the actual Apache::Filter code, just stuff in
   the test suite.


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



Re: ANNOUNCE: Apache::Filter 1.017

2001-04-08 Thread Ken Williams

[EMAIL PROTECTED] (JR Mayberry) wrote:
Is it required to, for instance, if you had a 4 chain handler as follows:

ReadCache-Handler-WriteCache-Apache::Compress

for the WriteCache handler to do:  $r-filter_input() and $r-print()
while $fh  even if it doesnt need to?

If I don't do that I seem to be losing all output, when I get to the
Apache::Compress stage

I'm not actually sure which of two questions you might actually mean. 
If you mean 

 A) Must I call $r-filter_register in each handler?

the answer is yes.  Otherwise the bookkeeping gets off.  If you mean

 B) Must I actually print the input handle to the output filehandle if I 
don't intend to change the data?

the answer is 'probably'.  

The input needs somehow to be turned to output.  Without doing this,
Apache::Filter can't tell the difference between a handler that doesn't
intend to change the output, and a handler that doesn't intend to send
any output at all.

This discussion suggests that perhaps there ought to be an easy/quick
way for a handler to declare that it doesn't intend to change the
output.  Perhaps a method could be added to Apache::Filter for this, if
it's a common need.

Right now, you could do the following in the no-op handlers:

  $r = $r-filter_register();
  my $fh = $r-filter_input;
  $r-send_fd($fh);

(though I'm not quite sure why these exist as content handlers if
they're no-ops.)


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



Re: Apache::Compress and Apache::Filter

2001-04-06 Thread Ken Williams

Yeah, looks like I need to look at this problem for real.  Your fix
should be fine - in fact, it'll work in all cases, it's just not as fast
as possible if a real send_fd can be done.

I'll get something working soon and release it.


[EMAIL PROTECTED] (JR Mayberry) wrote:
I hack/fixed it by taking out the check to see if its the last module in a
chain..

For me, that is always a safe assumption..

Let me know if theres ever a real fix..


- Original Message -
From: "Ken Williams" [EMAIL PROTECTED]
To: "JR Mayberry" [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, April 06, 2001 1:10 AM
Subject: Re: Apache::Compress and Apache::Filter


 Hi JR,

 I've been avoiding this bug to my peril.  Does the following patch fix it?

 =
 --- Filter.pm   2000/12/20 03:43:44 1.16
 +++ Filter.pm   2001/04/06 05:05:24
 @@ -120,8 +120,8 @@

  sub send_fd {
my $self = shift;
 -  if ($self-is_last_filter) {
 +  if ($self-is_last_filter and !Universal::isa($_[0], ref $self)) {
  $self-SUPER::send_fd(@_);
} else {
  my $fd = shift;
 =

 The bug occurs when the client doesn't support gzip, and you're using
 Apache::Filter, and Apache::Compress is the final filter in the chain.


 [EMAIL PROTECTED] (JR Mayberry) wrote:
 Does anyone know anything about the above combo, and getting an error
 message:
 Bad filehandle at Filter.pm line 123
 
 when using a client that doesnt support gzip..(specifically 'ab', apache
 bench)


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



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



ANNOUNCE: Apache::Filter 1.017

2001-04-06 Thread Ken Williams

The URL

http://www.mathforum.com/~ken/modules/archive/Apache-Filter-1.017.tar.gz

has entered CPAN as

  file: $CPAN/authors/id/K/KW/KWILLIAMS/Apache-Filter-1.017.tar.gz
  size: 24147 bytes
   md5: 304aabb626ae8694ca75e639b1981e7b


Changes from 1.016:

   Fixed a filehandle bug in which send_fd() would complain about a 'Bad
   filehandle'.  Occurred most often with Apache::Compress.
   
   Added a couple of tests to properly exercise the send_fd() method.


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



Re: Apache::Compress and Apache::Filter

2001-04-05 Thread Ken Williams

Hi JR,

I've been avoiding this bug to my peril.  Does the following patch fix it?

=
--- Filter.pm   2000/12/20 03:43:44 1.16
+++ Filter.pm   2001/04/06 05:05:24
@@ -120,8 +120,8 @@
 
 sub send_fd {
   my $self = shift;
-  if ($self-is_last_filter) {
+  if ($self-is_last_filter and !Universal::isa($_[0], ref $self)) {
 $self-SUPER::send_fd(@_);
   } else {
 my $fd = shift;
=

The bug occurs when the client doesn't support gzip, and you're using
Apache::Filter, and Apache::Compress is the final filter in the chain.


[EMAIL PROTECTED] (JR Mayberry) wrote:
Does anyone know anything about the above combo, and getting an error
message:
Bad filehandle at Filter.pm line 123

when using a client that doesnt support gzip..(specifically 'ab', apache
bench)


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



Re: Run away processes

2001-04-04 Thread Ken Williams

[EMAIL PROTECTED] (Aaron Johnson) wrote:
In "the guide" it is recommended that a sub in the startup.pl file:
sub UNIVERSAL::AUTOLOAD {
   my $class = shift;
   warn "$class can't \$UNIVERSAL::AUTOLOAD!\n";
 }

You'll get more useful information if you get rid of the backslash:

  sub UNIVERSAL::AUTOLOAD {
my $class = shift;
warn "$class can't $UNIVERSAL::AUTOLOAD!\n";
  }

Stas - this should be changed in the guide, on the
'All_RAM_Consumed.html' page.

My guess at your problem - you haven't pre-loaded all necessary modules
in your startup files (httpd.conf and startup.pl).  The code is
disappearing when the children die and are re-spawned.


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



Re: Apache::Filter

2001-03-26 Thread Ken Williams

[EMAIL PROTECTED] (Manfred Hui) wrote:
I have recently installed Kent Williams' Apache::Filter Module, and 
tested it with the supplied UC module and it worked with simple cgi scripts.

However I have experienced a problem though when my cgi calls CGI.pm's 
redirect() and header().

Instead of getting the appropiate headers, eg. 302 Moved.

I get a standard Content-type: text/html without reference to any 
location headers.

I was wondering if anyone else had experienced the same problem and/or 
have a solution to this?

Here is what my cgi script looks like.

#!/usr/bin/perl -w
use CGI;
my $ob = new CGI;
print $ob-redirect('http://www.cnn.com');

My Apache PerlHandler is set to Apache::RegistryFilter Apache::UC

Manfred,

I think there is a problem with the CGI-redirect method, because it
uses Apache-request (and there is a problem with that).  So your script
must use shift() to get the current request object, and then send
headers manually.  Try this instead (untested):

  #!/usr/bin/perl -w
  my $r = shift;
  $r-err_header_out(Location = 'http://www.cnn.com');
  $r-status(302);
  $r-send_http_header();

The downside of this, of course, is that it won't work under regular CGI.


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



Re: [OT] ApacheCon BOF

2001-03-21 Thread Ken Williams

[EMAIL PROTECTED] (Alexander Farber (EED)) wrote:
Bakki Kudva wrote:
 Just look at the sports teams. You couldn't have a team called the
 Washington Kikes or the Washington Micks. But yet you can have the
 Washington Redskins and this Indian with a big nose and big lips running
 around. How would you feel if it was the Washington Rabbis and you had a
 guy with braids running around throwing bagels?

Hey, that would be very funny! And I'm jewish.

It sounds like kind of a funny idea in theory, perhaps for a Saturday
Night Live skit, but how horrible it would be if this were actually
carried out with a real team and a real city.


Guys, relax - I don't believe, that using feathers and/or Apache 
is offending anyone, esp. because it's a nice piece of software.

That may be right, but I live in a community with a lot of Native
Americans, I have a (pretty small) bit of Cherokee heritage myself, and
there's no way in hell I'm going to wear, in public, a shirt that uses
stereotypical Indian symbols to promote something as far removed as web
server software.  It would feel like an affront on my chest.

Anyway, it seems the shirt isn't going toward this idea, so in that
sense the point is moot, but some of the discussion has really been
rubbing me the wrong way.  I don't think it's proper for one person to
dictate the situations in which another person is supposed to take
offense, and the situations in which he/she shouldn't.  That's not how
emotions work.


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



Re: ApacheCon session handouts

2001-03-19 Thread Ken Williams

[EMAIL PROTECTED] (Dave Rolsky) wrote:
Oops, deleted the message but someone just asked if the session notes
would be available via the web.

I don't know of the official ApacheCon plan but I can say that mine (for
my Intro to Mason presentation) will be available somewhere.

At most conferences the notes aren't available unless the speaker wants
them to be.  That seems to be because some people make a living off
giving talks like this to corporate clients, and can't afford to give
material like this away for free.  Or simply (especially in the case of
more grass-roots things like YAPC) that the speaker didn't have time to
put together snazzy notes that would be meaningful to off-site people.

It's also possible that the sponsor (O'Reilly) isn't thrilled about
making material easily available for people who weren't willing to pay
the registration fees.

Personally I have no idea whether notes for ApacheCon will be generally
available or not, but these are some of the possible reasons for not
doing so.  

The benefits for putting them up are obvious. =)


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



Re: Installing mod_perl on MacOSX

2001-03-15 Thread Ken Williams

[EMAIL PROTECTED] (Philippe de Rochambeau) wrote:
has anyone ever installed/compiled mod_perl for MacOSX? If so, how
exactly did you do it?


See this thread: 
   http://forum.swarthmore.edu/epigone/modperl/philsmangyi

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



Re: to clarify (getting what was printed in PerlHandler)

2001-03-13 Thread Ken Williams

[EMAIL PROTECTED] (JR Mayberry) wrote:
It's not really as plug and play as I was looking for..

I'm surprised that theres no built in functionality to allow any of the
post-handler phases to be able to retreive what was dumped out...

If you think about it, it would be a terrible idea to allow the kind of
thing you're looking for.  It would mean that when the programmer asks
the output to be sent to the user, the web server instead doesn't send
it, but piles it up somewhere just in case the programmer decides that
he/she might want to look at it again.  If the content is large, it
would be a huge waste of memory resources, or of disk access (if
cached), or the like.

If you want to re-access the output you sent, you'll have to collect it
yourself, or use the efforts that I and others have put into modules
like Apache::Filter, which makes it easy.


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



Re: Passing Objects with PerlSetVar

2001-03-12 Thread Ken Williams

[EMAIL PROTECTED] (darren chamberlain) wrote:
I just found Apache::Storage URL:http://tangent.org/Apache-Storage/,
which will let you store complex data structures from httpd.conf:

# httpd.conf
ApacheStore o { "bar" = 1, "foo" = "com", "other" = 0 }

In your handler, do:

use Apache::Storage;
sub handler {
my $r = shift;
my $o = get_storage('o');

...

And so on.


I wonder why I've never heard of this module before.  It looks like it's
never been discussed on the list, and it's not in the module list.


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



Re: getting content post PerlHandler phase

2001-03-12 Thread Ken Williams

[EMAIL PROTECTED] (JR Mayberry) wrote:
Is it possible to retreive what was printed in the PerlHandler phase (what
was called w/ $r-print()), in
any of the post PerlHandler phases?

Perhaps you want something like Apache::Filter?


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



Re: to clarify (getting what was printed in PerlHandler)

2001-03-12 Thread Ken Williams

[EMAIL PROTECTED] (JR Mayberry) wrote:
Is it possible to retreive what was printed in the PerlHandler phase
(what was called w/ $r-print()), in any of the post PerlHandler phases?


[EMAIL PROTECTED] (JR Mayberry) wrote:
a way to do it transparently...(ie: not changing code)

i realize there are ways to do it otherwise..

Which code do you not want to change?  Some code *somewhere* is going to
have to change, or else (obviously) nothing different is going to happen.

There are several ways to do this without changing any of the print
statements, is that what you mean?


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



Re: Is it Apache or me?

2001-02-25 Thread Ken Williams

[EMAIL PROTECTED] (Jamie Krasnoo) wrote:

I'm not quite sure how this works, and maybe I missed it in the Eagle book.
I have a handler set in httpd.conf like this:

Location /
   Set-Handler perl-script
   PerlHandler app::main
/Location

Now this works great when I want to go to the first page of the server.
However if I try to go to a static page, that page gets intercepted and the
app::main goes in to action. The handler doesn't intercept any of the other
set locations. Why is it intercepting static pages? Is it a standard rule
that a handler for Location / is never set?

It sounds like you want this (or similar):

Files index.html
Set-Handler perl-script
PerlHandler app::main
/Files

Using Location / sets things for the entire server, because it means
"everything below /".


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



Re: mod_perl_traps my($var) = '';

2001-02-20 Thread Ken Williams

[EMAIL PROTECTED] (Helios de Creisquer) wrote:
I used at beginning of script:
   ...
   my($var) = '';
   ...
I know this is a little dirty... everyway,
It seems that when mod_perl encouter a 'my' statement,
it doesn't evaluate it again next time the script is executed.



[EMAIL PROTECTED] (Vasily Petrushin) wrote:
my ($var) = ('');



That's not the problem.  See
http://perl.apache.org/guide/perl.html#my_Scoped_Variable_in_Nested_S .
It's a bit long, but thorough.  Especially see "The Remedy" section.


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



Re: Help with configuration - Linux/Mandrake 7.2

2001-02-18 Thread Ken Williams

If it doesn't use mod_perl, what *does* it do?  Display the source? 
Give a 404?

Perhpas you need to do "Alias /perl /var/www/perl" , with a slash.

Officially, I loathe Apache configuration, so I often try to stay
ignorant of its intricacies. =)


[EMAIL PROTECTED] (Rich Feather) wrote:
I'm trying to get my Apache Web Server to read *.pl files using mod_perl 
(standard Linux-Mandrake 7.2).  Under perl, it works fine and, indeed, in 
httpd-perl.conf, it shows 

Alias perl /var/www/perl
Directory /var/www/perl
SetHandler perl-script
PerlHandler Apache::Registry
PerlSendHeader On
Options ExecCGI -Indexes
/Directory

Also, I've tried up the following

Directory /var/www/html
SetHandler perl-script
PerlHandler Apache::Registry
PerlSendHeader On
Options ExecCGI -Indexes
/Directory

and/or

Files *.pl
SetHandler perl-script
PerlHandler Apache::Registry
Options ExecCGI
/Files

Restarted after each change
/etc/rc.d/init.d/httpd restart

but I cannot get the server to parse *.pl files using mod_perl.

Any ideas?

Thanks.


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



Re: General Question

2001-02-11 Thread Ken Williams

[EMAIL PROTECTED] (Buddy Lee Haystack) wrote:
Situation:
I press the submit button on a form 55 times in 15 seconds. Each
request would normally return data to the browser within ten seconds
due to the time it takes the database query to execute.


Question:
What happens to the 54 earlier processes, since I submitted the request 55 
times? How do Apache  mod_perl handle the processes to nowhere?

The output of the other processes goes to Belgium.  Some of it goes to
New Zealand too, but mostly to Belgium.  Pretty soon it's going to
really start piling up, and someone's going to have to start taking care
of it.  Volunteer bit shovelers are appreciated.

(Sorry, couldn't resist. =)


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



Re: How do I debug failed tests? (error_log isn't helping)

2001-02-01 Thread Ken Williams

Jesse,

It looks from your output like the server isn't even running for these
tests.  Try to figure out whether that's true, and if so why it stopped
(or never started).

The debugging process here is admittedly a bit difficult.

There's an archive at http://mathforum.com/epigone/modperl/ .

[EMAIL PROTECTED] (jesse) wrote:
here's current setup:
slackware 7.0, with kernel 2.2.16
trying to compile  test mod_perl 1.25 with fresh apache 1.3.17 source
have perl 5.6.0 installed
have libwww installed

make test has various errors (failed 18 total)
how do i debug these and fix them?

modules/cgi.ok 5/5FAILED test 4
Failed 1/5 tests, 80.00% okay
modules/perlrun.FAILED before any test output arrived
modules/status..fetch /perl/perl-status failed!
modules/status..dubious
Test returned status 111 (wstat 28416, 0x6f00)
DIED. FAILED tests 1-7
Failed 7/7 tests, 0.00% okay
internal/dirmagic...FAILED before any test output arrived
internal/http-get...NOK 16FAILED test 16
Failed 1/16 tests, 93.75% okay
internal/rwrite.NOK 2FAILED tests 1-2
Failed 2/2 tests, 0.00% okay
internal/table..FAILED before any test output arrived

Failed 7/33 test scripts, 78.79% okay. 11/244 subtests failed, 95.49% okay.


sorry if this has already been done over..
oh, and is there an archive of this mailing list? (since i just subscribed,
i'd 
like to look over some of the old stuff so i don't duplicate
too much)

thanks in advance..

-- 
jesse|everchanging.org


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



Re: Repost with typos corrected--Instance variable inheritance

2001-01-30 Thread Ken Williams

[EMAIL PROTECTED] (Joe Schaefer) wrote:


"Christopher L. Everett" [EMAIL PROTECTED] writes:

 sub handler ($$) {
   my ($self, $q);
 
   my $r = Apache::Request-new($q);
 
   # send headers here
 
   print $self-name;
  
$self is a string ("simian"), not an object ref; for this 
line to work, you need to make one by calling "new" somewhere,
or guard against misuse via:

print $self-name if ref $self;


Technically there's nothing wrong with that, it'll call the name()
method of the "simian" class.  It may not be what you want to do, but
it's legal.

The error is that the name() method doesn't expect to be called as a
class method, it's an object method.  So as Joe points out, you could
add the following line:

   sub handler ($$) {
 my ($self, $q);

 -  $self = $self-new();
 my $r = Apache::Request-new($q);

 # send headers here

 print $self-name;
 return OK;
   }


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



Re: Repost with typos corrected--Instance variable inheritance

2001-01-30 Thread Ken Williams

[EMAIL PROTECTED] (Vasily Petrushin) wrote:
On Tue, 30 Jan 2001, Ken Williams wrote:
sub handler ($$) {
  my ($self, $q);
 
  -  $self = $self-new(); ??? 8-[   ] who is $self-new() ???

   $self = PackageName-new();

This is a Perl question and not a mod_perl question, so I don't want to
get into a big discussion here, but I meant what I wrote.  Try running
the following program to see what I mean:


  ==
  package Fooey;

  sub method {
my $self = shift;
 - $self = $self-new;
  }

  sub new {
my $class = shift;
return bless {}, $class;
  }


  package main;

  $class = 'Fooey';
 -   $object = $class-method;

  print "\$object is an object, see: $object\n";
  ==

The lines with the arrows demonstrate the technique you didn't think
would work.


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



Re: Advice needed. (web app. performance)

2001-01-29 Thread Ken Williams

[EMAIL PROTECTED] (Stas Bekman) wrote:
On Mon, 29 Jan 2001, Vladislav Safronov wrote:
 I've just finished a simple web based spellcheck application
 based on ispell, it's written as perl module which just call
 ispell on every request (actually keeps it open afert first request).
 The bad thing is N users used spellcheck there are N running
 useless ispells and it is not good I think. 


Have you checked CPAN?

http://search.cpan.org/search?dist=Lingua-Ispell

It looks like that simply calls out to the ispell program.


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



Re: pseudo-hashes? was: Data structure question

2001-01-22 Thread Ken Williams

[EMAIL PROTECTED] (Perrin Harkins) wrote:
On Mon, 22 Jan 2001 [EMAIL PROTECTED] wrote:
 (section 4.3, pp 126-135) I hadn't heard about pseudo-hashes. I now
 desire a data structure with non-numeric keys, definable iteration
 order, no autovivification, and happy syntax. (And, of course,
 fast-n-small :-) Having Conway's blessing is nice

Pseudo-hashes do not have Conway's blessing.  We hired him to do a
tutorial for our engineers a few omnths back, and he railed about how
disappointing pseudo-hashes turned out to be and why no one should ever
use them.  I had already reached the same conclusion after I saw that
everyone would have to remember to say "my Dog $spot;" every time or the
whole thing falls apart.

At the last YAPC he talked about the various unsatisfactory approaches
and finally seemed to advocate for his Tie::SecureHash module.  Among
other things, it allows '__private', '_protected', and 'public' data
members.  I'm not sure whether it supports explicit declarations of key
names, but I bet it could be added easily if not.

I haven't used the module, but wanted to pass along the info.


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



  1   2   3   >