Re: modules and pragmas - part II
On Sep 24, 2002 at 23:14:02 +0200, [EMAIL PROTECTED] wrote: At the first request each instance prints out the no_xhtml-header, but at the second call the no_xhtml-pragma is forgotten and the xhtml-header is printed out. Is this a problem in the CGI-module or is there a deeper reason for this in mod_perl ? The problem lies in CGI.pm itself. It installs a cleanup handler which resets $CGI::XHTML to 1 after each request... sub new { Apache-request-register_cleanup(\CGI::_reset_globals); } sub _reset_globals { initialize_globals() }; sub initialize_globals { $XHTML = 1; } So you'll need to set $CGI::XHTML=0 every time you call CGI-new to get it to work right. --rick
Re: same module with different pragmas
On Sep 23, 2002 at 17:05:07 -0400, Perrin Harkins wrote: [EMAIL PROTECTED] wrote: In the sets of applications that runs under mod_perl on our webserver we need the same modules twice, but with different pragmas. app1: use module qw(standard pragma1); app2: use module qw(standard pragma2); now, of course - whichever application is needed first it loads the module with the mentioned pragma. Later - when the second app wants to load the module, mod_perl uses the already module with the wrong pragma. The problem is that CGI.pm is a bunch of nasty old code that uses global variables like they were going out of style (which they are). The simplest solution might be to stop using CGI.pm and switch to something faster and cleaner. However, failing that you may have to hack the CGI.pm code a little to make a way to turn the XHTML header on and off. $CGI::XHTML = 1; # turn it on $CGI::XHTML = 0; # turn it off (Although, can't you just use -no_xhtml all the time?) Is there any trick around this problem or do I need to copy the module and alter its name ? That won't help. It's about the module namespace, not the file name. - Perrin --rick
Re: Handler Concept / Question
On Aug 12, 2002 at 11:50:56 -0600, Thomas Whitney wrote: I was following this thread with interest because I want to do something like this. I started searching on list archive for the above mentioned syntax, I searched for 'static content', then 'default handler', but with no luck. I do not mind doint the the searching, if you would perhaps suggest a couple other search topics. You were close. It's default-handler. http://httpd.apache.org/docs/handler.html --rick
Re: virtual host server root
On Mar 01, 2002 at 19:30:37 +, Ged Haywood wrote: Hi there, On Wed, 27 Feb 2002, Rick Myers wrote: I'm trying to create a root directory for each of my virtuals the realm of the virtual that certainly shouldn't be within [snip] I've come up with three solutions, none of which I particularly like for various reasons Have you looked at mod_macro? I hadn't until now, but it looks interesting Not quite what I had in mind though Thanks --rick
Re: how to disable mod_perl in a subdir? Directory vs Location
On Feb 28, 2002 at 05:54:07 -0700, Dan Baker wrote: Rick Myers wrote: On Feb 27, 2002 at 21:14:00 -0700, Dan Baker wrote: I am working with a host that has everything under /cgi-bin running mod_perl by default, and well as using EmbPerl to run the dynamic pages This begs the question, how are they doing that? I mean, if they're using Location's or File's then you're going to have to bend to their whim since those override Directory's -- hhmmm, so if they have set up in httpdconf: Alias /cgi-bin/ /home/seniordiscounts/cgi-bin/ Location /cgi-bin SetHandler perl-script #PerlHandler Apache::PerlRun PerlHandler Apache::Registry Options +ExecCGI /Location then the non mod_perl section: Directory /home/seniordiscounts/cgi-bin/webadmin/ SetHandler default-handler AddHandler cgi-script pl AllowOverride All /Directory will be overidden? Right At least that's how I read the relevant doc http://httpdapacheorg/docs/sectionshtml I guess then I should add an alias line and switch to using Location ? That would work, but see the above doc Location's are processed in the order they appear in the conf file --rick
virtual host server root
I'm trying to create a root directory for each of my virtuals. The reason is that there's plenty of stuff within the realm of the virtual that certainly shouldn't be within the document root -- templates, cache, logs, etc. Plus, I might want to point a virtual into a user dir somewhere. I've come up with three solutions, none of which I particularly like for various reasons. - PerlSetVar VRoot /someplace Simple, but I've always had a distaste for PerlSetVar for some reason. *shrug* - VRoot /someplace Not as simple. Requires yet another module to implement and adds even more overhead to the server conf file. - ServerPath /someplace Pretty simple Server.xs hack, but probably never supported. Also might open up security holes. Is anybody else doing this sort of thing? --rick
Re: When handlers misfire
On Feb 21, 2002 at 15:23:04 -0800, Milo Hyson wrote: On Wednesday 20 February 2002 07:55 pm, Geoffrey Young wrote: If the redirected request needs that session data, there's a small chance it won't be there yet. have you seen this? I don't recall this ever coming up before (which doesn't mean it can't happen :) Yes, I have seen it happen. Quite frequently in fact. My investigation into the problem is how I discovered the cleanup handler wasn't doing its job in time. Want to see something even more interesting? Let your debugging warnings mention the pid that caused the log entry and let it run a while on a production server. I see stuff like... (12345) NEW REQUEST (12345) NEW REQUEST (12345) NEW REQUEST (12345) CLEANUP DONE (12345) CLEANUP DONE (12345) CLEANUP DONE ...often enough to have noticed. If I grep around a bit I can find many instances of this sort of thing. In one case I saw page hits that also warned other info with timestamps. The first four requests were timestamped, the fifth wasn't, the sixth was, and the seventh wasn't. At the end of the seventh all seven cleanups fired off. The difference in time between the first and last timestamps was almost four *minutes*. --rick
Re: Make test issue with the URI module
On Feb 04, 2002 at 16:24:38 +0100, Thomas Klausner wrote: Does anyone know why this fails or how to fix it properly? This question was originally asked back in August. http://mathforum.org/epigone/modperl/sehpholzhex With some followup... http://mathforum.org/epigone/modperl/zhenphimgrand --rick
Has anyone else seen this?
I'm referring to Term::Readline problems. A while back I had all sorts of trouble with Term::Readline and was basically deleting it any time this that or the other module insisted it be there. Recently things have been pretty quiet so I've been letting it live. Suddenly though, as I was adding some top level directives to a mod_perl module, Apache::DB quit working with the spew below the sig. I know I can back out my work or maybe delete Term::Readline again (and recompile the whole works *sigh*), but that's not the point. If anyone's seen or heard of this, I'd appreciate a hint. Rick Myers[EMAIL PROTECTED] The Feynman Problem 1) Write down the problem. Solving Algorithm 2) Think real hard. 3) Write down the answer. Start of spew My::Declined::handler(/home/rik/perllib/My/Declined.pm:5): 5: sub handler { DECLINED } Signal SEGV at /usr/lib/perl5/site_perl/5.6.0/Term/ReadLine/readline.pm line 460 require 0 called at /usr/lib/perl5/site_perl/5.6.0/Term/ReadLine/readlin e.pm line 459 readline::preinit called at /usr/lib/perl5/site_perl/5.6.0/Term/ReadLine /readline.pm line 192 require Term/ReadLine/readline.pm called at /usr/lib/perl5/site_perl/5.6 .0/Term/ReadLine/Perl.pm line 58 require 0 called at /usr/lib/perl5/site_perl/5.6.0/Term/ReadLine/Perl.pm line 58 Term::ReadLine::Perl::new('Term::ReadLine', 'perldb', 'GLOB(0x82b58d4)', 'GLOB(0x82b5844)') called at /usr/lib/perl5/site_perl/5.6.0/i686-linux/Apache/p erl5db.pl line 1758 DB::setterm called at /usr/lib/perl5/site_perl/5.6.0/i686-linux/Apache/p erl5db.pl line 592 DB::DB called at /home/rik/perllib/My/Declined.pm line 5 My::Declined::handler('Apache=SCALAR(0x83699d8)') called at /usr/lib/per l5/site_perl/5.6.0/i686-linux/Term/ReadKey.pm line 0 require 0 called at /usr/lib/perl5/site_perl/5.6.0/i686-linux/Term/ReadK ey.pm line 0 Abort End of spew
Re: [OT] log analyzing programs
On Dec 02, 2001 at 07:33:55 -0800, Bill Moseley wrote: Date: Sun, 02 Dec 2001 07:33:55 -0800 To: [EMAIL PROTECTED] From: Bill Moseley [EMAIL PROTECTED] Subject: Re: [OT] log analyzing programs At 10:09 AM 12/2/2001 +, Matt Sergeant wrote: PID USERNAME THR PRI NICE SIZE RES STATE TIMECPU COMMAND 17223 operator 1 442 747M 745M cpu14 19.2H 45.24% wusage Ouch. Try analog. PID USERNAME THR PRI NICE SIZE RES STATE TIMECPU COMMAND 17223 operator 1 02 747M 745M cpu14 27.1H 47.57% wusage Well at least after another 8 hours of CPU it's not leaking ;) I don't have a running analog right this second, but I run it on the following daily. I sure don't see the cpu usage you see, but it does take a couple hours to finish. (Mostly because analog doesn't hammer the dns server.) -rw-r--r-- 1 root root 311413188 Dec 2 10:50 access_log -rw-r--r-- 1 root root 89773421 Dec 2 10:37 azaleas2_access_log -rw-r--r-- 1 root root 13499455 Dec 2 10:21 azaleas3_access_log -rw-r--r-- 1 root root 10692999 Dec 2 10:37 error_log -rw-r--r-- 1 root root 7786067 Dec 2 00:33 sumthin2_log -rw-r--r-- 1 root root 142857 Nov 2 02:44 sumthin3_log --rick
Re: Mac OSX 10.1 - mod_perl build instructions
On Nov 08, 2001 at 11:31:39 -0800, Randal L. Schwartz wrote: sudo perl Makefile.PL \ APACHE_SRC=/opt/apache/1.3.22/src/apache_1.3.22/src \ NO_HTTPD=1 \ USE_APACI=1 \ PREP_HTTPD=1 \ EVERYTHING=1 # hit return a bunch of times That hit return a bunch of times has always bugged me. It seems to me that the combination of NO_HTTPD=1, PREP_HTTPD=1, and APACHE_SRC=??? has already answered the three questions that it's going to ask. Here's a little patch I wrote up for 1.25 to eliminate the questions. It still applies to the current 1.xx cvs versions with a bit of skew. --- Makefile.PL.origFri Mar 9 15:14:14 2001 +++ Makefile.PL Fri Mar 9 15:17:08 2001 @@ -493,6 +493,9 @@ } } +elsif ($NO_HTTPD !$PREP_HTTPD !$DO_HTTPD $APACHE_SRC) { + push(@adirs,$APACHE_SRC); +} if($PERL_EXTRA_CFLAGS) { $PERL_EXTRA_CFLAGS = join( , split(,, $PERL_EXTRA_CFLAGS)); @@ -525,7 +528,7 @@ if (-e $httpd_h) { unless($NO_HTTPD and not $DYNAMIC and not $PREP_HTTPD) { - unless($DO_HTTPD) { + unless($DO_HTTPD || $PREP_HTTPD $NO_HTTPD) { $ans = prompt(Configure mod_perl with $adir ?, y); next unless $ans =~ /^y$/i; } Rick Myers[EMAIL PROTECTED] The Feynman Problem 1) Write down the problem. Solving Algorithm 2) Think real hard. 3) Write down the answer.
Re: libapreq problem: solved
On Oct 14, 2001 at 01:19:05 +0200, Issac Goldstand wrote: Apparantly, I made a major mistake with the UPLOAD_HOOK error... While it still doesn't work, I found out what caused the mysterious error... The name space I happen to be using is TFile::*, and all of my upload-related handlers are stuffed into TFile::Upload. Unfortunately, out of force of habit, in the httpd.conf for the upload location, I did PerlHandler Apache::Upload instead of TFile::Upload... Sorry, guys :-( *hits himself in the head for everyone* Great that you figured out your problem, but you pointed out another. The current CPAN has a reference to the other libapreq... again. Stas, didn't you point this out on the dev list? --rick destined to travel the same path..
[OT] perl mailing lists
Sorry for the off-topic question, so I'll make it quick. Does anyone have pointers to any intermediate to advanced level perl mailing lists? Rick Myers[EMAIL PROTECTED] The Feynman Problem 1) Write down the problem. Solving Algorithm 2) Think real hard. 3) Write down the answer.
Re: can't build with 1.3.14 apache?
On Oct 14, 2000 at 12:06:29 -0700, [EMAIL PROTECTED] twiddled the keys to say: Try the patch to apache-1.3.14/src/include/httpd.h below. Worked for me. I had the same problem last night. As it turned out, the current cvs modperl version fixed it. (Hint: It's in Makefile.PL) Hello again bleeding edge. :) Rick Myers[EMAIL PROTECTED] The Feynman Problem 1) Write down the problem. Solving Algorithm 2) Think real hard. 3) Write down the answer.
Re: CGI.pm problem
On Aug 29, 2000 at 16:11:39 +0400, Alexei V. Barantsev twiddled the keys to say: Dear mod_perl'ers! I have found strange difference between object and func modes of CGI library. More precisely - I have a problem with Vars function. #use CGI qw(:standard :cgi-lib); CGI::_reset_globals; #my $args = Vars; _reset_globals() is normally called when you create a new CGI object. In this context though, your object lives on between script runs so you have to manually tell CGI to reset it. Rick Myers[EMAIL PROTECTED] The Feynman Problem 1) Write down the problem. Solving Algorithm 2) Think real hard. 3) Write down the answer.
Re: Patch to t/modules/request.t
On Aug 27, 2000 at 12:17:41 -0500, Ken Williams twiddled the keys to say: [EMAIL PROTECTED] (Rick Myers) wrote: I would lean towards the second one since upload_test() is called similarly from three different places within request.t. The reasoning behind suggesting `while defined FH' was that the interaction with $_ appears to be unintentional, at least within the scope of upload_test(). We're basically throwing away the content of the file read anyway, so why not just eliminate the undesired setting of $_ altogether. Also, there's no need to localize $_ since we aren't referencing it to do anything. for ( qw(perlfunc.pod perlpod.pod perlxs.pod), @binary) { upload_test($_); } sub upload_test { my $podfile = shift || "func"; ... ++$lines while defined FH; } FWIW, adding defined() was the perldiag-suggested fix for the problem Ken was seeing. It also happens to fix the read-only error quite nicely in this particular situation. Sounds good to me. But I still can't reproduce the original read-only error. The following code runs just fine for me under 5.004 and 5.005: @binary = "blah"; for ( qw(perlfunc.pod perlpod.pod perlxs.pod), @binary) { upload_test($_); } sub upload_test { ++$lines while STDIN; } The only funny business is that STDIN clobbers $_, so that the various values iterated through in the for() loop all eventually get set to undef. Aha! perl5.00503 -e 'test($_) for qw(a b c); print "OK\n"; sub test {$_=0}' OK perl5.6.0 -e 'test($_) for qw(a b c); print "OK\n"; sub test {$_=0}' Modification of a read-only value attempted at -e line 1. Chalk one up for 5.6 I guess. Rick Myers[EMAIL PROTECTED] The Feynman Problem 1) Write down the problem. Solving Algorithm 2) Think real hard. 3) Write down the answer.
Re: Patch to t/modules/request.t
On Aug 26, 2000 at 14:07:26 +0200, Stas Bekman twiddled the keys to say: On Fri, 25 Aug 2000, Rick Myers wrote: On Aug 24, 2000 at 23:15:15 -0500, Ken Williams twiddled the keys to say: [EMAIL PROTECTED] (Rick Myers) wrote: On Aug 24, 2000 at 01:15:57 -0500, Ken Williams twiddled the keys to say: The following patch eliminates a warning during 'make test' about 'Value of HANDLE construct can be "0";'. No biggie, but it should be fixed. --- t/modules/request.t 2000/05/12 03:43:24 1.8 +++ t/modules/request.t 2000/08/24 06:07:40 @@ -125,7 +125,7 @@ my $lines = 0; local *FH; open FH, $file or die "open $file $!"; -++$lines while (my $dummy = FH); +++$lines while FH; close FH; my(@headers); if ($Is_dougm) { This reverses a previous patch that fixes a fatal 'Modification of a read-only value attempted at modules/request.t line 128', which returns with this patch. See if this one finds us a happy median... --- t/modules/request.t~ Thu Aug 24 18:24:39 2000 +++ t/modules/request.t Thu Aug 24 18:41:22 2000 @@ -125,7 +125,7 @@ my $lines = 0; local *FH; open FH, $file or die "open $file $!"; -++$lines while (my $dummy = FH); +++$lines while defined FH; close FH; my(@headers); if ($Is_dougm) { THAT's weird - what in the world is the read-only value that's being modified? It's $_. Here's the relevant code from request.t to illustrate... for ( qw(perlfunc.pod perlpod.pod perlxs.pod), @binary) { upload_test($_); } sub upload_test { ++$lines while FH; } The real fix should be either: for my $file ( qw(perlfunc.pod perlpod.pod perlxs.pod), @binary) { upload_test($file); } sub upload_test { ++$lines while FH; } or for ( qw(perlfunc.pod perlpod.pod perlxs.pod), @binary) { upload_test($_); } sub upload_test { local $_; ++$lines while FH; } I would lean towards the second one since upload_test() is called similarly from three different places within request.t. The reasoning behind suggesting `while defined FH' was that the interaction with $_ appears to be unintentional, at least within the scope of upload_test(). We're basically throwing away the content of the file read anyway, so why not just eliminate the undesired setting of $_ altogether. Also, there's no need to localize $_ since we aren't referencing it to do anything. for ( qw(perlfunc.pod perlpod.pod perlxs.pod), @binary) { upload_test($_); } sub upload_test { my $podfile = shift || "func"; ... ++$lines while defined FH; } FWIW, adding defined() was the perldiag-suggested fix for the problem Ken was seeing. It also happens to fix the read-only error quite nicely in this particular situation. Rick Myers[EMAIL PROTECTED] The Feynman Problem 1) Write down the problem. Solving Algorithm 2) Think real hard. 3) Write down the answer.
Re: Patch to t/modules/request.t
On Aug 24, 2000 at 23:15:15 -0500, Ken Williams twiddled the keys to say: [EMAIL PROTECTED] (Rick Myers) wrote: On Aug 24, 2000 at 01:15:57 -0500, Ken Williams twiddled the keys to say: The following patch eliminates a warning during 'make test' about 'Value of HANDLE construct can be "0";'. No biggie, but it should be fixed. --- t/modules/request.t 2000/05/12 03:43:24 1.8 +++ t/modules/request.t 2000/08/24 06:07:40 @@ -125,7 +125,7 @@ my $lines = 0; local *FH; open FH, $file or die "open $file $!"; -++$lines while (my $dummy = FH); +++$lines while FH; close FH; my(@headers); if ($Is_dougm) { This reverses a previous patch that fixes a fatal 'Modification of a read-only value attempted at modules/request.t line 128', which returns with this patch. See if this one finds us a happy median... --- t/modules/request.t~ Thu Aug 24 18:24:39 2000 +++ t/modules/request.t Thu Aug 24 18:41:22 2000 @@ -125,7 +125,7 @@ my $lines = 0; local *FH; open FH, $file or die "open $file $!"; -++$lines while (my $dummy = FH); +++$lines while defined FH; close FH; my(@headers); if ($Is_dougm) { THAT's weird - what in the world is the read-only value that's being modified? It's $_. Here's the relevant code from request.t to illustrate... for ( qw(perlfunc.pod perlpod.pod perlxs.pod), @binary) { upload_test($_); } sub upload_test { ++$lines while FH; } The hint is that `while FH' will try to set $_ to the value of each line read. Rick Myers[EMAIL PROTECTED] The Feynman Problem 1) Write down the problem. Solving Algorithm 2) Think real hard. 3) Write down the answer.
Re: Patch to t/modules/request.t
On Aug 25, 2000 at 21:02:32 -0400, Billy Donahue twiddled the keys to say: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Fri, 25 Aug 2000, Rick Myers wrote: From: Rick Myers [EMAIL PROTECTED] On Aug 24, 2000 at 23:15:15 -0500, Ken Williams twiddled the keys to say: [EMAIL PROTECTED] (Rick Myers) wrote: +++$lines while defined FH; THAT's weird - what in the world is the read-only value that's being modified? It's $_. And why is $_ read-only? I'm clueless about the perlguts involved here, but I'm thinking ultimately because it's global... perl -e 'test($_) for qw/a b c/; print "OK\n"; sub test {$_=0}' Modification of a read-only value attempted at -e line 1. perl -e 'test($_) for qw/a b c/; print "OK\n"; sub test {local $_=0}' OK Rick Myers[EMAIL PROTECTED] The Feynman Problem 1) Write down the problem. Solving Algorithm 2) Think real hard. 3) Write down the answer.
Re: Patch to t/modules/request.t
On Aug 25, 2000 at 21:25:59 -0400, Rick Myers twiddled the keys to say: On Aug 25, 2000 at 21:02:32 -0400, Billy Donahue twiddled the keys to say: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Fri, 25 Aug 2000, Rick Myers wrote: From: Rick Myers [EMAIL PROTECTED] On Aug 24, 2000 at 23:15:15 -0500, Ken Williams twiddled the keys to say: [EMAIL PROTECTED] (Rick Myers) wrote: +++$lines while defined FH; THAT's weird - what in the world is the read-only value that's being modified? It's $_. And why is $_ read-only? I'm clueless about the perlguts involved here, but I'm thinking ultimately because it's global... perl -e 'test($_) for qw/a b c/; print "OK\n"; sub test {$_=0}' Modification of a read-only value attempted at -e line 1. perl -e 'test($_) for qw/a b c/; print "OK\n"; sub test {local $_=0}' OK *Ugh* I guess I have to correct myself here... As it turns out, the perldiag page is correct. In the above examples $_ can't be modified because it "points" to constant values (the qw construct). perl -e 'for ($_=0;$_5;$_++) {test($_)} print "OK\n"; sub test {$_=0}' produces an infinite loop perl -e 'for ($_=0;$_5;$_++) {test($_)} print "OK\n"; sub test {local $_=0}' OK Nevertheless, the real problem in request.t is still the `while FH'. Rick Myers[EMAIL PROTECTED] The Feynman Problem 1) Write down the problem. Solving Algorithm 2) Think real hard. 3) Write down the answer.
Re: Patch to t/modules/request.t
On Aug 24, 2000 at 01:15:57 -0500, Ken Williams twiddled the keys to say: The following patch eliminates a warning during 'make test' about 'Value of HANDLE construct can be "0";'. No biggie, but it should be fixed. --- t/modules/request.t 2000/05/12 03:43:24 1.8 +++ t/modules/request.t 2000/08/24 06:07:40 @@ -125,7 +125,7 @@ my $lines = 0; local *FH; open FH, $file or die "open $file $!"; -++$lines while (my $dummy = FH); +++$lines while FH; close FH; my(@headers); if ($Is_dougm) { This reverses a previous patch that fixes a fatal 'Modification of a read-only value attempted at modules/request.t line 128', which returns with this patch. See if this one finds us a happy median... --- t/modules/request.t~Thu Aug 24 18:24:39 2000 +++ t/modules/request.t Thu Aug 24 18:41:22 2000 @@ -125,7 +125,7 @@ my $lines = 0; local *FH; open FH, $file or die "open $file $!"; -++$lines while (my $dummy = FH); +++$lines while defined FH; close FH; my(@headers); if ($Is_dougm) { Rick Myers[EMAIL PROTECTED] The Feynman Problem 1) Write down the problem. Solving Algorithm 2) Think real hard. 3) Write down the answer.
Re: When will PerlLogHandler *not* run
On Aug 21, 2000 at 23:45:48 -0400, Paul G. Weiss twiddled the keys to say: Needless to say, I find that under certain conditions that I'm not completely sure of, the loghandler doesn't run and the object does get undef'ed (I know this from using perl-status and from the fact that the process in question doesn't give me any timing statistics from then on). The question is, what combination of events could cause the log handler not to run once I've pushed it, yet leave the process intact to handle another request? -Paul Weiss Whoops. I meant to say "the loghandler doesn't run and the object *doesn't* get undef'ed." This may or may not have any bearing on this question, but something I've seen is that $r-register_cleanup() will stop responding sometimes. After a while a whole pile of cleanups from one given child will just do their thing one after another. I've always wondered why that is. Why doesn't that child just hang instead of storing up all the registered cleanups? Rick Myers[EMAIL PROTECTED] The Feynman Problem 1) Write down the problem. Solving Algorithm 2) Think real hard. 3) Write down the answer.
Re: cgis and subrequests
On Aug 20, 2000 at 19:38:53 -0700, Alex Menendez twiddled the keys to say: cgi scripts. the module uses lookup_uri() to generate a subrequest then calls run() to output the actual contents of the file. the eagle book says that calling run() on a subrequest should automatically send the client the appropriate http headers and the document's body. However, I have found that this is not the case. The following code does not send http headers for both cgis and html docs. The body stuff is working fine but the headers are not being sent: my $uri = $r-uri; unless(!$r-args) { $uri = $uri .'?'.$r-args; } my $subr = $r-lookup_uri($uri); if($r-dir_config('is_cgi')) { $subr-handler('cgi-script'); } else { $subr-handler('server-parsed'); } $subr-run(); my $status = $subr-status; $r-print(create_img_tag($file,$SCRIPT_ON,$status)); return $status; any ideas? Yes. run() no longer sends headers (as far as I know). I don't know when it was changed, but it pre-dates my experience. I've had the following working just fine for close to a year now (or maybe my sense of time is warped :). my $lookup = $r-lookup_uri( $uri ); $r-send_http_header( 'text/html' ); my $status = $lookup-run; $r-status( $status ); Rick Myers[EMAIL PROTECTED] The Feynman Problem 1) Write down the problem. Solving Algorithm 2) Think real hard. 3) Write down the answer.
Re: make test failure
On Aug 08, 2000 at 19:49:58 +0800, Kenneth Lee twiddled the keys to say: Today I run make test with mod_perl the first time (I was skipping it before) modules/request.Modification of a read-only value attempted at modules/request.t line 128. modules/request.dubious Test returned status 2 (wstat 512, 0x200) DIED. FAILED tests 3-10 Failed 8/10 tests, 20.00% okay What does this mean? I couldn't find it in the guide. I'm using all the latest packages with RedHat 6.1 on x86. apache 1.3.12 perl 5.6.0 mod_perl 1.24 libapreq 0.31 Are you *sure* you have 1.24? I supplied a patch for request.t back in April that fixed that problem and made its way into 1.23. (I also just checked 1.24 and my one-liner is still there. :) [EMAIL PROTECTED]">http://forum.swathmore.edu/epigone/modperl/fringkyby/[EMAIL PROTECTED] Rick Myers[EMAIL PROTECTED] The Feynman Problem 1) Write down the problem. Solving Algorithm 2) Think real hard. 3) Write down the answer.
Re: Weird Perl behaviour
On Jul 19, 2000 at 10:09:36 +0300, Alex Shnitman twiddled the keys to say: On Tue, Jul 18, 2000 at 11:30:44PM -0400, Rick Myers wrote: Another interesting thing about this issue: if I assign $port{$portname} + 1 to $Port, and not just $port{$portname}, it works! If I ever try to return $Port to the needed value, e.g. using the -- operator, it doesn't work again. This completely stumps me. I tried just about any trick you can think of to get the value from $port{$portname} to $Port, but I can't -- if I add to it or substract from it, it's fine, but if it somehow gets back to the original value, in any way, it doesn't work again. Does that give any new ideas as to the source of this issue? Yes. The source of the issue is that you sent your ErrorLog to /dev/null. Send it somewhere else where you can read it and you should find the error in short order. That's what I do in my configuration file -- I just trimmed it down to show just the code that matters in the sample that I sent to the list. Here's the error I get in the error log: [Wed Jul 19 10:07:14 2000] [crit] (13)Permission denied: make_sock: could not bind to port 80 It couldn't bind to port 80 because another web server is running there. This means that it didn't recognize the $Port setting, although printing $Port from within the config file prints 8010 properly. That's precisely the problem. After fooling with this for several hours I've finally come to the conclusion that this is probably an Apache "problem". The quickest way to illustrate it is trying this Perl section... Perl my %port = ( zz = 8014 ); warn "PORTHASH: $port\n"; use POSIX (); my $portname = POSIX::getcwd(); chomp $portname; warn "PORTNAME1: '$portname'\n"; $portname =~ s:.*/::; warn "PORTNAME2: '$portname'\n"; $Port = $port{$portname}; warn "PORT: '$Port'\n"; my $ppid = getppid; warn "PPID: $ppid\n"; /Perl Now, try running your server as before, but make sure you have access to the ErrorLog file. You'll notice that several of the warn()'s generate completely different output in the error_log than they do on your shell screen. The first significant difference is that PORTNAME1 points to `/home/zz' (or wherever you started httpd from) in your shell, while in the error_log it points to `/'. I'd almost bet money that the conf file is parsed the first time under your shell, then again after Apache has disassociated itself, thus showing you seemingly valid output on the shell. If you then grep through the Apache source you'll find this in src/main/http_main.c... static void detach(void) { #if !defined(WIN32) !defined(NETWARE) int x; chdir("/"); Bingo! Now the question is how to pass the proper directory name to mod_perl's Perl sections. The answer lies subtly tucked away on p. 423 of the Eagle book. Just add a PerlPassEnv to your conf file... PerlPassEnv PWD Then use $ENV{PWD} instead of POSIX::getcwd() and you should be all set. *whew* Rick Myers[EMAIL PROTECTED] The Feynman Problem 1) Write down the problem. Solving Algorithm 2) Think real hard. 3) Write down the answer.
Re: Weird Perl behaviour
On Jul 18, 2000 at 22:34:05 +0300, Alex Shnitman twiddled the keys to say: Another interesting thing about this issue: if I assign $port{$portname} + 1 to $Port, and not just $port{$portname}, it works! If I ever try to return $Port to the needed value, e.g. using the -- operator, it doesn't work again. This completely stumps me. I tried just about any trick you can think of to get the value from $port{$portname} to $Port, but I can't -- if I add to it or substract from it, it's fine, but if it somehow gets back to the original value, in any way, it doesn't work again. Does that give any new ideas as to the source of this issue? Yes. The source of the issue is that you sent your ErrorLog to /dev/null. Send it somewhere else where you can read it and you should find the error in short order. Rick Myers[EMAIL PROTECTED] The Feynman Problem 1) Write down the problem. Solving Algorithm 2) Think real hard. 3) Write down the answer.
Re: apache restart causes httpd to grow and grow
On Jul 13, 2000 at 18:42:06 -0500, Rob Ries twiddled the keys to say: I can serve requests with no dramatic changes in httpd size. However, each "apachectl restart" causes the size of httpd (both parent and children version) to grow by about 600K each restart. I'm new to this stuff, so I'm sure it's me. Is it possible that the restart loads again the modules - ie, I get 2 copies of the modules in memory? If so, can I do something about it? I can't answer that question. Sorry. Or is the rule: don't use "restart", just use "stop/start"? If that's the case, what's "restart" for? I use "graceful" myself. Most of the time it will do a full restart, but I've noticed that sometimes strange things happen. For those cases I created a bash alias... (all on one line, of course ;) restart /var/apache/bin/apachectl configtest ( /var/apache/bin/apachectl stop ; sleep 2 ; /var/apache/bin/apachectl start ) Rick Myers[EMAIL PROTECTED] The Feynman Problem 1) Write down the problem. Solving Algorithm 2) Think real hard. 3) Write down the answer.
Re: DIR_MERGE and .htaccess
On Jul 04, 2000 at 14:40:26 +0100, Matt Sergeant twiddled the keys to say: Shouldn't DIR_MERGE be called when .htaccess files are found at different levels, e.g: /axkit/.htaccess and /axkit/test/.htaccess I ask for /axkit/test/test.xsp I would have expected it to ask for both .htaccess files and try and merge the two using DIR_MERGE, but it doesn't. Am I missing something, or is this expected functionality? I can't answer that question, but a while back I noticed that sometimes PerlSetVar's weren't being seen by $r-dir_config as I'd expected. Namely, within the "global" section of a VirtualHost. I wrote a little module as an example, but never got around to voicing anything about it. From what I saw then, DIR_MERGE nor SERVER_MERGE ever got called at all. Maybe we're missing the same thing? Rick Myers[EMAIL PROTECTED] The Feynman Problem 1) Write down the problem. Solving Algorithm 2) Think real hard. 3) Write down the answer.
Re: search engine for the Guide (was Re: Why does $r-print()...)
On May 04, 2000 at 10:37:05 +0100, Matt Sergeant twiddled the keys to say: On Thu, 4 May 2000, Stas Bekman wrote: On Wed, 3 May 2000, Matt Sergeant wrote: On Wed, 3 May 2000, Stas Bekman wrote: Yeah, I've been thinking about it. There was one site that has offered me to provide a good search engine and they did, but the problem is that they didn't keep up with new releases, so people were searching the outdated version, which is quite bad -- I've removed the reference to it, after asking them to update their copy for a few months, with no results. Can't we use WWW::Search - If I recall correctly some of the sites can be restricted to a domain, so you could build a search interface pretty easily. DESCRIPTION : This class is the parent for all access methods supported by the WWW::Search library. This library implements a Perl API to web-based search engines. It's not the search engine -- it's a Perl API to the search engines. We need a search engine not the API to it. Did I miss something? Yes. On some of the search engines (AltaVista springs to mind) you can search for things on particular web sites, or even links to particular web sites. So as long as AltaVista keeps its search contents up to date, you can leverage their engine. IIRC either Randall or Lincoln did a WebTechniques article about this a few months ago. Leveraging the existing engines is a good idea, if you have fairly static content. If you're a moving target though, I'm of the opinion that it would be better to have an "in-house" engine. The existing engines are "nice" and don't invade your site too intrusively, so you end up with references which tend to lag current content. How to deal with that is not something I've thought about. The one time I tried an engine I ended up with a forking agrep, which comes as part of the Glimpse package. Glimpse itself sucks (in my opinion), but agrep works pretty good. The problem with it is you have to fork, which of course sucks. Oh well. My .02 :) Rick Myers[EMAIL PROTECTED] The Feynman Problem 1) Write down the problem. Solving Algorithm 2) Think real hard. 3) Write down the answer.
Re: Apache::GzipChain
On Apr 11, 2000 at 07:49:57 -0400, Paul G. Weiss twiddled the keys to say: I was playing around with this module and got strange results (both with MSIE 5.0 and Netscape 4.6). The output is being sent chunked and when I do "view source" it appears that the browsers have not received the complete page. I suspect that they are only reading up to the first "chunk". Your suspicion is correct. The problem however lies in whatever module your using to feed GzipChain. In my case it was Apache::PassFile, which sends in 16k chunks. Apache::PassHtml looks like it suffers from a similar problem, but I've not tried it. Rick Myers[EMAIL PROTECTED] The Feynman Problem 1) Write down the problem. Solving Algorithm 2) Think real hard. 3) Write down the answer.
Re: Apache::GzipChain
On Apr 11, 2000 at 08:36:42 -0400, Paul G. Weiss twiddled the keys to say: I'm using Apache::RegistryNG to feed GzipChain. But doesn't the chunking occur *after* GzipChain? I've also tried Apache::Registry with the same results. From the Apache::GzipChain man page.. GzipChain compresses every single buffer content it receives via the output chain separately according to the GZIP specification (RFC 1952). The compression ratio therefore suffers if the other module sends its data in very small chunks. So apparently the browsers can't cope with multiple gzip'ed chunks. If your send the content to GzipChain in one large hunk the problem goes away. Rick Myers[EMAIL PROTECTED] The Feynman Problem 1) Write down the problem. Solving Algorithm 2) Think real hard. 3) Write down the answer.
Re: all protected but one...
On Dec 15, 1999 at 09:56:03 -0400, Eric L. Brine twiddled the keys to say: What is the best way to have a Location directive apply to an entire site except for a single directory? Set the site-wide handler in a Location "/" and override the handler for the "register" dir by setting the default handler in Location "/register". Unfortuntaly, I don't know the name of the default handler. SetHandler default-handler Rick Myers[EMAIL PROTECTED] The Feynman Problem 1) Write down the problem. Solving Algorithm 2) Think real hard. 3) Write down the answer.
Re: System calls to return data via STDOUT
On Dec 07, 1999 at 01:53:20 -0800, hamid khoshnevis twiddled the keys to say: I am trying to call Glimpse from modperl and capture the data set back. After I wrote the email, I was told by a friend that I should use temporary files to capture the output of Glimpse. Any ideas?? Pipe it to a filehandle. Something like... open PIPE, "/bin/glimpse |"; while (PIPE) { push @array, $_; } Not very mod_perl'ish, but it saves re-inventing the glimpse engine in perl. Rick Myers[EMAIL PROTECTED] The Feynman Problem 1) Write down the problem. Solving Algorithm 2) Think real hard. 3) Write down the answer.
Re: $r-run with no headers
On Nov 11, 1999 at 07:21:00 +, Rick Myers twiddled the keys to say: Quite simply, I can't set headers on a -run. I've tried before the fact, as well as within the object itself. Anybody have any pointers? Answering my own question... $lookup = $r-lookup_uri( $somewhere ); $r-headers_out-add( anything = 'whatever' ); $r-send_http_header; $lookup-run; RTFM :) Rick Myers[EMAIL PROTECTED] The Feynman Problem 1) Write down the problem. Solving Algorithm 2) Think real hard. 3) Write down the answer.
$r-run with no headers
Quite simply, I can't set headers on a -run. I've tried before the fact, as well as within the object itself. Anybody have any pointers? Rick Myers[EMAIL PROTECTED] The Feynman Problem 1) Write down the problem. Solving Algorithm 2) Think real hard. 3) Write down the answer.
Re: multiple cookies in Apache module.
On Oct 15, 1999 at 15:30:08 +0700, Simon Tneoh Chee-Boon twiddled the keys to say: Hello, I already tested by using telnet. I found that CGI-header works fine, it sends two line of "Set-Cookie". Apache-header_out doesn't work, if I call it twice, only the second cookie is sent in one "Set-Cookie" line. So I wonder is it because I'm not familiar with the methods in Apache module, i.e. I miss out something, or Apache-header_out does not support this? $r-headers_out-add( 'Set-Cookie' = $cookie ); Rick Myers[EMAIL PROTECTED] The Feynman Problem 1) Write down the problem. Solving Algorithm 2) Think real hard. 3) Write down the answer.
finding real path to same server uri's
To make a long story short, is there a way in mod_perl to do something like... $r-real_path( 'http://some.virtual.domain/whatever/page/there.is' ) The cut-to-the-chase version is, I need to know the filename of a referer page originating on this server. (Yes, there are virtuals involved, and yes there are numerous aliases.) Rick Myers[EMAIL PROTECTED] The Feynman Problem 1) Write down the problem. Solving Algorithm 2) Think real hard. 3) Write down the answer.