Re: tracking down why a module was loaded?;

2000-09-14 Thread Matt Sergeant

On Thu, 14 Sep 2000, Justin wrote:

> Can anyone tell me the easiest slickest way of determining
> what was responsible for requesting a module, having discovered
> that it has been loaded when viewing perl-status?

use OtherPackage; # because you need import to be defined first
sub OtherPackage::import {
 warn join(':', caller), " tried to load me\n";
}

Not foolproof, and could cause more damage than good, but sometimes its a
useful debugging technique.

> modperl is the best kept secret on the net. Shame!

Indeed!

-- 


Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org | AxKit: http://axkit.org




mod_perl guide corrections

2000-09-14 Thread Joe Schaefer

Stas,

I was looking over the latest version of the performance
section, and I have a few suggestions/comments regarding

http://perl.apache.org/guide/performance.html

1) Your description of keep-alive performance is confusing. 
Every browser I've seen that implements keep-alives
will open at least 2 connections per server (HTTP/1.1 mandates
a max of 2, but 1.0 browsers like netscape open 3 or more).  The
browsers are usually smart enough to round-robin the requests
between connections, so there's really no sequential delay.

Furthermore, HTTP/1.1 keepalive connections can be pipelined, to
make multiple requests on each connection without waiting for each 
server response.  In any real-world implementation, keepalives 
are a clear winner over closed connections, even if they're 
only left idle for a second or two.

Since most of us put a reverse proxy between the mod_perl server
and the browser; running keepalives on the browser<->proxy connection
is desirable.

I think your section on keepalives and their usefulness should include
some of the above comments.  Recently I posted a patch for mod_proxy 
to the mod_perl mailing list that enables keep-alives on the browser side;
I've also written a small Apache Perl module that does the same thing.
They also do store-and-forward on the request body (POST data), which 
addresses an issue you raised in 

http://perl.apache.org/guide/scenario.html#Buffering_Feature 
...
There is no buffering of data uploaded from the client browser to the proxy, 
thus you cannot use this technique to prevent the heavy mod_perl server from 
being tied up during a large POST such as a file upload. Falling back to mod_cgi 
seems to be the best solution for these specific scripts whose major function is 
receiving large amounts of upstream data. 
...


2) Apache::Request is better than your performance numbers indicate.

The problem I have with your comparison with Apache::args vs Apache::Request vs CGI
is that your benchmark code isn't fair.  You're comparing method calls against
hash-table lookups, which is apples and oranges.  To get more representative
numbers, try the following code instead

processing_with_apache_request.pl
 -
 use strict;
 use Apache::Request ();
 my $r = shift;
 my $q = Apache::Request->new($r);
 $r->send_http_header('text/plain');
 my $args = $q->param; # hash ref
 print join "\n", map {"$_ => ".$$args{$_} } keys %$args;

and similiarly for CGI.  The numbers you get should more accurately reflect
the performance of each.

HTH
-- 
Joe Schaefer
[EMAIL PROTECTED]

SunStar Systems, Inc.





Re: perl initialization per virtual host... is it possible

2000-09-14 Thread William Deegan


- Original Message - 
From: "Ime Smits" <[EMAIL PROTECTED]>
To: "William Deegan" <[EMAIL PROTECTED]>
Cc: "G.W. Haywood" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, September 14, 2000 2:26 PM
Subject: Re: perl initialization per virtual host... is it possible


> 
> 
> | I meant a different startup per virtual host, not per child process.
> 
> It's perfectly ok to specify a PerlRequire for each virtual host
> or even in .htaccess, but I think that's a dirty habbit to get
> into. As the complete perl namespace is shared between all
> your virtual hosts there is  really no benifit, just drawbacks:
> modules required before Apache forks off will result in all
> childs using a single copy of that module, but required modules
> after that will load a copy for each child process.


When I do that a "SetEnv" in my virtual host doesn't seem to get
passed to the startup.pl...

Is that the expected behavior?

-Bill




Re: perl initialization per virtual host... is it possible

2000-09-14 Thread David Hodgkinson


"William Deegan" <[EMAIL PROTECTED]> writes:

> Ged,
> 
> I think you may have misunderstood.
> 
> I meant a different startup per virtual host, not per child process.
> 
> Is that possible?

If you're going to do that, say, to stop virtual servers interfering
with each other, consider having COMPLETELY different fat servers
hidden behind your thin one.

-- 
Dave Hodgkinson, http://www.hodgkinson.org
Editor-in-chief, The Highway Star   http://www.deep-purple.com
  Apache, mod_perl, MySQL, Sybase hired gun for, well, hire
  -



Re: perl initialization per virtual host... is it possible

2000-09-14 Thread Ime Smits



| I meant a different startup per virtual host, not per child process.

It's perfectly ok to specify a PerlRequire for each virtual host
or even in .htaccess, but I think that's a dirty habbit to get
into. As the complete perl namespace is shared between all
your virtual hosts there is  really no benifit, just drawbacks:
modules required before Apache forks off will result in all
childs using a single copy of that module, but required modules
after that will load a copy for each child process.

Ime




Re: perl initialization per virtual host... is it possible

2000-09-14 Thread William Deegan

Ged,

I think you may have misunderstood.

I meant a different startup per virtual host, not per child process.

Is that possible?

-Bill
- Original Message - 
From: "G.W. Haywood" <[EMAIL PROTECTED]>
To: "William Deegan" <[EMAIL PROTECTED]>
Sent: Thursday, September 14, 2000 1:16 PM
Subject: Re: perl initialization per virtual host... is it possible


> Hi there,
> 
> On Thu, 14 Sep 2000, William Deegan wrote:
> 
> > Is it possible to setup different Initialization per virtual host?
> > 
> > so perhaps one:
> > PerlRequire /usr/local/www_sh/conf/startup.pl
> > 
> > per virtual host, each different.
> 
> No, startup.pl is run before the server forks any children.  But you
> can have lots of different servers running on the one machine.  Then
> you could have a proxy which feeds to the appropriate server depending
> on the URI.
> 
> Would that do it, or would it be too painful?
> 
> 73,
> Ged.
> 
> 
> 




Re: tracking down why a module was loaded?;

2000-09-14 Thread Stas Bekman

On Thu, 14 Sep 2000, Justin wrote:

> Can anyone tell me the easiest slickest way of determining
> what was responsible for requesting a module, having discovered
> that it has been loaded when viewing perl-status?

A.pm:
-
package A;
use Carp ();
BEGIN { Carp::cluck("I don't want to wake up!!!")}
1;

test.pl
---
require "A.pm";

now run:
% perl test.pl
I don't want to wake up!!! at A.pm line 4
A::BEGIN() called at A.pm line 4
eval {...} called at A.pm line 4
require A.pm called at test.pl line 1

Also see:
perldoc -f caller


> and while I've got the podium:
> I would like to congratulate Doug and 
> everyone involved in modperl.. by checking
> pcdataonline.com, I found our entirely modperl site is
> now #1850 in the top 10,000 websites, with over 10 million
> *entirely dynamic* pages pushed out a month.. to half a 
> million unique users. This is a single Dell 2300 box with
> two PII 450s cpus and a gig of memory.. (the mysql server
> is on another box). Most pages are built between 20-100ms
> of user time.. the same box runs backend and frontend
> servers, serves images as well, plus a hunk of other
> processes.
> If a fortune500 company asked razor fish / concrete media
> to build them a website that would scale to that, with
> entirely dynamic pages, they'd be dragging the client down
> to Sun to pick out the color of their enterprise 4000, or
> microsoft would be pushing a cluster of multi processor
> compaqs and NT servers with all possible software trimmings
> added.. and then you'd need a team of specialists to keep
> the whole thing moving.. no wonder dotcoms go broke.

Wow! That's cool!

> modperl is the best kept secret on the net. Shame!

:)

_
Stas Bekman  JAm_pH --   Just Another mod_perl Hacker
http://stason.org/   mod_perl Guide  http://perl.apache.org/guide 
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://jazzvalley.com
http://singlesheaven.com http://perlmonth.com   perl.org   apache.org





Re: segfaulting httpd :(

2000-09-14 Thread Bruce W. Hoylman


> "Ben" == Ben Turner <[EMAIL PROTECTED]> writes:

Ben> this afternoon i compiled a fresh httpd (apache 1.3.12),
Ben> together with mod_perl 1.24. i'm on Solaris 8, running perl
Ben> 5.6.0.

Sounds like what I happened to just go through, finding perl 5.6.0 as
the (known) culprit.  Go to:

http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-06/msg00200.html

and apply the supplied patch.  It fixed my SIGSEGVs immediately.  HTHYO.

Peace.



tracking down why a module was loaded?;

2000-09-14 Thread Justin

Can anyone tell me the easiest slickest way of determining
what was responsible for requesting a module, having discovered
that it has been loaded when viewing perl-status?


and while I've got the podium:
I would like to congratulate Doug and 
everyone involved in modperl.. by checking
pcdataonline.com, I found our entirely modperl site is
now #1850 in the top 10,000 websites, with over 10 million
*entirely dynamic* pages pushed out a month.. to half a 
million unique users. This is a single Dell 2300 box with
two PII 450s cpus and a gig of memory.. (the mysql server
is on another box). Most pages are built between 20-100ms
of user time.. the same box runs backend and frontend
servers, serves images as well, plus a hunk of other
processes.
If a fortune500 company asked razor fish / concrete media
to build them a website that would scale to that, with
entirely dynamic pages, they'd be dragging the client down
to Sun to pick out the color of their enterprise 4000, or
microsoft would be pushing a cluster of multi processor
compaqs and NT servers with all possible software trimmings
added.. and then you'd need a team of specialists to keep
the whole thing moving.. no wonder dotcoms go broke.

modperl is the best kept secret on the net. Shame!

- 
Justin Beech  http://www.dslreports.com



segfaulting httpd :(

2000-09-14 Thread Ben Turner


hi all,

this afternoon i compiled a fresh httpd (apache 1.3.12), together with
mod_perl 1.24. i'm on Solaris 8, running perl 5.6.0.

after compiling httpd, i'm getting segfaults whenever i do a normal http
request. for instance:

http://bla/index.html works noprob
http://bla/ does not work, and my errorlog shows a segfault (signal 11).

anybody know what's goign on here?

thanks!

Ben

"Nothing is ever easy."
Zeddicus Z'ul Zorander




segfault hell

2000-09-14 Thread Bill Moseley

I'm running current Apache and mod_perl 1.24.  Solaris 2.6. 2G RAM.

PerlFreshRestart is off.

I've had these segfaults for months.  I only get a few a day out of say
20,000 mod_perl requests.  So the children come and go before I can get
strace or gdb on them.  

They often happen in groups -- as if something funky happens to the OS and
a few segfault all at once.  It's not the URI that's triggering the
segfault, and I've never been able to trigger it myself.  It can happend
after just a few requests to a httpd child, or after many requests to a child.

Any other ideas on how to catch this in action without generating a huge
log file?  Set MaxRequestsPerChild huge and attach gdb to every child?  

Undefined subroutine &Apache::RegistryNG->handler::handler called at
/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Apache.pm line 184.

Then that child may server up a few more static files, but next time
there's a mod_perl request:

Can't locate object method "handler" via package "handler" at
/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Apache.pm line 184.

I am using a $SIG{__DIE__} handler in my Registry script, which just writes
to a log file and calls (the overridden) exit.



Bill Moseley
mailto:[EMAIL PROTECTED]



Re: Still having problems with mod_perl and Apache::ASP

2000-09-14 Thread Jim Serio

> OK .. you guys are probably sick of me by now ... I think I know what my
> problem is.  I need to edit my httpd.conf file.  What do I need to put into
> the httpd.conf file to configure mod_perl and what do I do to configure
> Apache::ASP -- both are installed on my system.  Also, my httpd.conf has
> virtual hosts -- do I need to put the information there or what??

Jason,

Have you looked at the mod_perl page (perl.apache.org)? It has
some VERY nice examples of how to configure mod_perl. You should
at least look there (and maybe even search the archives) before
posting here... sort of a CYA thing :-) If you have the money, you
may wish to purchase the eagle book but most of what's in there
is at the above URL or has been discussed in this list (archives
available).

Jim
-- 
Jim Serio - [EMAIL PROTECTED]
Producer, World of Coasters



Still having problems with mod_perl and Apache::ASP

2000-09-14 Thread Jason

OK .. you guys are probably sick of me by now ... I think I know what my
problem is.  I need to edit my httpd.conf file.  What do I need to put into
the httpd.conf file to configure mod_perl and what do I do to configure
Apache::ASP -- both are installed on my system.  Also, my httpd.conf has
virtual hosts -- do I need to put the information there or what??

Sorry for being a pain,

Jason

P.S.
Thanks for all the help so far!




perl initialization per virtual host... is it possible

2000-09-14 Thread William Deegan

Greetings,

Is it possible to setup different Initialization per virtual host?

so perhaps one:
PerlRequire /usr/local/www_sh/conf/startup.pl

per virtual host, each different.

-Bill Deegan



Apache::ASP

2000-09-14 Thread Gael Pegliasco

Hello,

Does someone know if there is a way to chain Apache::ASP output with
Apache::OutputChain or Apache::Filter ?

I'd like to do something like this :


SetHandler perl-script
PerlHandler Apache::OutputChain Apache::MakeCapital Apache::ASPCHain


or Something like :


 SetHandler perl-script
 PerlSetVar Filter On
 PerlHandler FilterASP FilterCapital


Thanks for your reply

With kind regards,

Gael,



RE: does notes() work with custom_response()?

2000-09-14 Thread Geoffrey Young



> -Original Message-
> From: brian d foy [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 14, 2000 9:58 AM
> To: [EMAIL PROTECTED]
> Subject: RE: does notes() work with custom_response()?
> 
> 
> On Thu, 14 Sep 2000, Geoffrey Young wrote:
> 
> > remember that custom_response() is a tie into Apache's ErrorDocument
> > handling, which uses an internal redirect, and for internal 
> redirects you
> > can use $r->prev to get at the initial request's stuff.  
> See the eagle book
> > for more detail...
> 
> okay - i got that to work.  i was getting confused because 
> notes from the
> handler() were showing up in the current request's notes for the
> custom_response() handler *and* (as i've discovered) in the previous
> notes.  should that happen? 

if you are doing (as I suspect)


   SetHandler LinkBank5::ErrorTest
...



   SetHandler LinkBank5::ErrorTest
...


$r->prev->notes and $r->notes will both contain the note set by handler()
because it's being called twice...

--Geoff


> 
> notice the duplicated LB-handler:
> 
>   #the stuff from $r->notes
>   Notes are -
>   LB-handler => Run at Thu Sep 14 09:50:11 2000
>   PERL_CUR_HOOK => PerlHandler
> 
>   #the stuff from $r->prev->notes
>   Prev Notes are -
>   LB-Error => Oops! i messed up
>   LB-handler => Run at Thu Sep 14 09:50:11 2000
>   PERL_CUR_HOOK => PerlHandler
> 
> > from this and your other post, you might want to take a look at
> > 
> http://perl.apache.org/guide/perl.html#Exception_Handling_for_mod_perl
> 
> > to get another perspective on exception handling...
> 
> however, i'm not doing anything with exceptions.  i'm not 
> handling errors
> - i'm aborting the request as a last ditch scenario.  for 
> some reason the
> script has decided that it can't continue and wants to send DONE while
> still taking care of some logging and notification.
> 
> --
> brian d foy  <[EMAIL PROTECTED]>
> Director of Technology, Smith Renaud, Inc.
> 875 Avenue of the Americas, 2510, New York, NY  10001
>   V: (212) 239-8985
> 



RE: does notes() work with custom_response()?

2000-09-14 Thread brian d foy

On Thu, 14 Sep 2000, Geoffrey Young wrote:

> remember that custom_response() is a tie into Apache's ErrorDocument
> handling, which uses an internal redirect, and for internal redirects you
> can use $r->prev to get at the initial request's stuff.  See the eagle book
> for more detail...

okay - i got that to work.  i was getting confused because notes from the
handler() were showing up in the current request's notes for the
custom_response() handler *and* (as i've discovered) in the previous
notes.  should that happen? 

notice the duplicated LB-handler:

#the stuff from $r->notes
Notes are -
LB-handler => Run at Thu Sep 14 09:50:11 2000
PERL_CUR_HOOK => PerlHandler

#the stuff from $r->prev->notes
Prev Notes are -
LB-Error => Oops! i messed up
LB-handler => Run at Thu Sep 14 09:50:11 2000
PERL_CUR_HOOK => PerlHandler

> from this and your other post, you might want to take a look at
> http://perl.apache.org/guide/perl.html#Exception_Handling_for_mod_perl

> to get another perspective on exception handling...

however, i'm not doing anything with exceptions.  i'm not handling errors
- i'm aborting the request as a last ditch scenario.  for some reason the
script has decided that it can't continue and wants to send DONE while
still taking care of some logging and notification.

--
brian d foy  <[EMAIL PROTECTED]>
Director of Technology, Smith Renaud, Inc.
875 Avenue of the Americas, 2510, New York, NY  10001
V: (212) 239-8985




Re: ActivePerl 617 and GD.ppd

2000-09-14 Thread Randy Kobes

On Wed, 13 Sep 2000, Foo, Ji Haw wrote:

> I tried to install gd (http://www.activestate.com/packages) on build 617,
> but it keeps telling me:
> Error installing package 'GD.ppd': Could not locate a PPM binary of 'GD.ppd'
> for this platform.
> 
> This same package works well for build 522 (which is why I am still using
> build 522). I would like to try upgrade to 617, but this problem is bugging
> me. Any suggestions?
> 
> Btw, I had to download the gd.ppd as well as the corresponding zips/ and
> x86/ files into my own machine because of firewall issues.
> 
> regards,
> 
> Ji-Haw, Foo
> Network Engineer (AP)

I just tried installing GD via ppm, and it worked fine (on build 617). 
Did you try this with build 617, or at least a build based on Perl-5.6.0?
Package binaries that need a C compiler, like GD and mod_perl, based
on Perl 5.005_03 aren't compatible with those based on Perl 5.6.0 in 
the ActiveState world (because of ActiveState's use of PERL_OBJECT in
5.00503). If you're installing GD by hand, make sure you choose the
relevant subdirectory for your system (5.6 or 5.005) at
http://www.activestate.com/ppmpackages/.

best regards,
randy kobes




RE: does notes() work with custom_response()?

2000-09-14 Thread Geoffrey Young



> -Original Message-
> From: brian d foy [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 14, 2000 9:09 AM
> To: [EMAIL PROTECTED]
> Subject: RE: does notes() work with custom_response()?
> 
> 
> On Thu, 14 Sep 2000, Geoffrey Young wrote:
> 
> 
> i was using:
> 
> > -   my $notes  = $r->notes;
> > -   my $pnotes = $r->pnotes;
> 
> you suggested:
> 
> > +   my $notes  = $r->prev->notes || $r->notes;
> > +   my $pnotes = $r->prev->pnotes || $r->pnotes;
> 
> neither of those worked for me.  did they work for you?

well, I tried to understand what you were doing so I set up a quick test and
yes, it worked - but I may not be reproducing your setup exactly...

remember that custom_response() is a tie into Apache's ErrorDocument
handling, which uses an internal redirect, and for internal redirects you
can use $r->prev to get at the initial request's stuff.  See the eagle book
for more detail...

from this and your other post, you might want to take a look at
http://perl.apache.org/guide/perl.html#Exception_Handling_for_mod_perl

to get another perspective on exception handling...

HTH

--Geoff


> 
> --
> brian d foy  <[EMAIL PROTECTED]>
> Director of Technology, Smith Renaud, Inc.
> 875 Avenue of the Americas, 2510, New York, NY  10001
>   V: (212) 239-8985
> 



RE: does notes() work with custom_response()?

2000-09-14 Thread brian d foy

On Thu, 14 Sep 2000, Geoffrey Young wrote:


i was using:

> -   my $notes  = $r->notes;
> -   my $pnotes = $r->pnotes;

you suggested:

> +   my $notes  = $r->prev->notes || $r->notes;
> +   my $pnotes = $r->prev->pnotes || $r->pnotes;

neither of those worked for me.  did they work for you?

--
brian d foy  <[EMAIL PROTECTED]>
Director of Technology, Smith Renaud, Inc.
875 Avenue of the Americas, 2510, New York, NY  10001
V: (212) 239-8985




RE: How to close connect and continue processing?

2000-09-14 Thread Vladislav Safronov

> On Thu, 14 Sep 2000, Vladislav Safronov wrote:
> 
> > I read the guide and I think the best is just add "&" :)
> > (how could I forget it!)
> > ..
> > system("myprog la la &");
> > print "";
> > # end
> 
> True, but what happens if your program tries to print 
> something. You've
> all in/out/err streams inherited, where in/out are tied to a 
> socket. You
> must close them at the beginning of the external script.

hm.. it's true. I should back to the guide ... 
Thanx for the help!

Vlad.

> 
> Anyway, it might be neater to use &, but performance wise is 
> not, since
> you spawn a shell. Of course for the heavily loaded systems. Fork is
> faster.
> 
> > 
> > 
> > > On Thu, 14 Sep 2000, Matt Sergeant wrote:
> > > 
> > > > On Thu, 14 Sep 2000, Matt Sergeant wrote:
> > > > 
> > > > > On Thu, 14 Sep 2000, Vladislav Safronov wrote:
> > > > > 
> > > > > > Hi,
> > > > > > 
> > > > > > After user request my script should say that the 
> > > request is accepted and
> > > > > > continue processing user data (it takes a time) so I 
> > > want to tell the
> > > > > > browser
> > > > > > that all data is sent. I searched mod_perl guide but I 
> > > didn't find such code
> > > > > > snippet.
> > > > > > Could you send me such example?
> > > > > 
> > > > > $r->register_cleanup(\&do_big_work);
> > > > 
> > > > I should have mentioned that this is far from a perfect 
> > > solution (cue
> > > > Stas) as it ties up a mod_perl process. See the guide 
> for alternate
> > > > solutions.
> > > 
> > > Like Matt has said, this used mostly for light things 
> like logging or
> > > process killing (Apache::{SizeLimit|GTopLimit}). See the 
> performance
> > > chapter for forking techniques for heavy jobs:
> > > http://perl.apache.org/guide/performance.html#Forking_and_Exec
> > > uting_Subprocess
> > > 
> > > 
> > > > 
> > > > -- 
> > > > 
> > > > 
> > > > Fastnet Software Ltd. High Performance Web Specialists
> > > > Providing mod_perl, XML, Sybase and Oracle solutions
> > > > Email for training and consultancy availability.
> > > > http://sergeant.org | AxKit: http://axkit.org
> > > > 
> > > > 
> > > 
> > > 
> > > 
> > > 
> _
> > > Stas Bekman  JAm_pH --   Just Another 
> mod_perl Hacker
> > > http://stason.org/   mod_perl Guide  
http://perl.apache.org/guide 
> > mailto:[EMAIL PROTECTED]   http://apachetoday.com http://jazzvalley.com
> > http://singlesheaven.com http://perlmonth.com   perl.org   apache.org
> > 
> > 
> 



_
Stas Bekman  JAm_pH --   Just Another mod_perl Hacker
http://stason.org/   mod_perl Guide  http://perl.apache.org/guide 
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://jazzvalley.com
http://singlesheaven.com http://perlmonth.com   perl.org   apache.org





RE: does notes() work with custom_response()?

2000-09-14 Thread Geoffrey Young

try this:

--- Yours.pmThu Sep 14 08:04:00 2000
+++ Mine.pm Thu Sep 14 08:02:49 2000
@@ -57,8 +57,8 @@
{
my $r = shift;
 
-   my $notes  = $r->notes;
-   my $pnotes = $r->pnotes;
+   my $notes  = $r->prev->notes || $r->notes;
+   my $pnotes = $r->prev->pnotes || $r->pnotes;
 
$r->status( SERVER_ERROR );
$r->send_http_header;

HTH

--Geoff

> -Original Message-
> From: brian d foy [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, September 13, 2000 6:19 PM
> To: [EMAIL PROTECTED]
> Subject: does notes() work with custom_response()?
> 
> 
> 
> =head
> should notes() be available to a handler installed with
> custom_response()? 
> 
> notice the code below:
>   
>   0) handler() decides which function will handle the response
>   and sets a note.
>   
>   1) in test(), if part of the uri contains /error/, then
>   another note is set and a custom_response() is used.
>   the error() routine handles the error().  it sees the
>   note set by handler() but not by test(),
>   
>   2) in test(), if part of the uri contains /push/, then
>   a note is set and error() is installed as a handler.
>   error() then sees both notes.
> 
> should 1) propogate both notes? are things even designed to 
> work that way?
> =cut
> 
> package LinkBank5::ErrorTest;
> 
> use Apache::Constants;
> 
> sub handler
>   {
>   my $r = shift;
>   my $uri = $r->uri;
>   $r->notes( 'LB-handler' => "Run at @{[scalar localtime]}" );
> 
>   if( $uri =~ /test/ )
>   {
>   $r->push_handlers( PerlHandler => \&test ); 
>   return OK;
>   }
>   if( $uri =~ /error/ )
>   {
>   $r->push_handlers( PerlHandler => \&error ); 
>   return OK;
>   }
>   else { return DECLINED; }
>   }
>   
> sub test
>   {
>   my $r = shift;
>   my $uri = $r->uri;
>   
>   #this note is not set, although the handler note is propogated
>   if( $uri =~ /error/ ) # e.g. /test/error
>   {
>   $r->notes('LB-Error' => 'Oops! i messed up');
>   $r->notes('error-notes' => 'Oops! i messed up');
>   $r->custom_response( SERVER_ERROR, "/error" );
>   
>   return SERVER_ERROR; #tested with OK and DECLINED too
>   }
>   #using a PushHandler works
>   elsif( $uri =~ /push/ ) # e.g. /test/push
>   {
>   $r->notes('LB-Push' => 'Oops! i messed up');
>   $r->push_handlers( PerlHandler => \&error );
> 
>   return OK;
>   }
>   
>   $r->send_http_header;
>   
>   my $note = $r->notes('LB-handler');
>   $r->print("I'm in test!\n");
>   $r->print("The note is [$note]\n");
>   
>   return OK;
>   }
>   
> sub error
>   {
>   my $r = shift;
>   
>   my $notes  = $r->notes;
>   my $pnotes = $r->pnotes;
>   
>   $r->status( SERVER_ERROR );
>   $r->send_http_header;
>   
>   $r->print("I'm in error!\n");
>   
>   print "Notes are -\n";
>   print map { "$_ => $$notes{$_}\n" } sort keys %$notes;
> 
>   print "PNotes are -\n";
>   print map { "$_ => $$pnotes{$_}\n" } sort keys %$pnotes;
>   
>   return OK;
>   }
>   
> 1;
> 
> __END__
> 
> --
> brian d foy  <[EMAIL PROTECTED]>
> Director of Technology, Smith Renaud, Inc.
> 875 Avenue of the Americas, 2510, New York, NY  10001
>   V: (212) 239-8985
> 



Typo crashes Apache process

2000-09-14 Thread Lupe Christoph

Hi!

Sorry, I did not check if this is known problem.

I recently forgot to follow through with a name change (equivalent to
renaming  Some::SimpleModule to Some::Simple::Module). I moved the
file, but forgot to change the package name.

Here is a much smaller version of my module that shows the problem:

package Some::SimpleModule;

use Apache::Constants qw(:http);

sub handler {
  return DECLINED;
}

1;

Add this to a standard http.conf.default:


  SetHandler perl-script
  PerlHandler Some::Simple::Module


Then try accessing http://localhost/test.

In the error log with full trace on:

running 1 server configured stacked handlers for /test...
calling &{PerlHandler->[0]} (1 total)
perl_setup_env...26 keys
mod_perl: inc seqno to 1 for /test
Some::Simple::Module symbol table not found, loading...
loading perl module 'Some::Simple::Module'...ok
perl_init_ids: uid=60001, euid=60001, gid=65534, egid=65534
`PerlChildInitHandler' push_handlers() stack is empty
PerlChildInitHandler handlers returned -1
[Thu Sep 14 12:58:59 2000] [notice] child pid 8990 exit signal Segmentation Fault 
(11), possible coredump in /sw/www.biering

(Getting the coredump in Solaris requires some version dependent
fiddling. This is Solaris 8, where I just use coreadm.)

This is the stack trace from the core:

8046b0c 
perl_handler_ismethod(0x82b46c8,0x81e5f62,0x828ee0c,0x80e255c,0x82fa59c,0x82a5ce8) + 61
8046b5c perl_call_handler(0x82fa59c,0x824b83c,0x0,0x80bc386,0x81e4f99,0x82fa59c) + 413
8046bac 
perl_run_stacked_handlers(0x81e4f99,0x824b83c,0x82a5ce8,0x80ba521,0x80ba49c,0x8046db0) 
+ 299
8046bec perl_handler(0x824b83c,0x81e52aa,0xb,0x) + 1b7
8046c2c ap_invoke_handler(0x824b83c,0x29,0x8046c5c,0x80d92be) + 11d
8046c5c process_request_internal(0x824b83c,0xdf7d,0x8046c8c,0x80e2f75) + 5d0
8046c8c ap_process_request(0x824b83c,0x4,0x824b83c,0x80e4e91) + 32
8046cdc child_main(0x0,0x80e37c0,0x8046d0c,0x80e5245) + 617
8046d0c make_child(0x824383c,0x0,0x39c0aece,0x80e1fce) + 13c
8046d3c startup_children(0x5,0x824383c,0x8046d6c,0x80e596f) + 72
8046d6c standalone_main(0x3,0x8046df4,0x8046dcc,0x80e61cb) + 1a4
8046dcc main(0x3,0x8046df4,0x8046e04) + 3b0

I believe this crash happens because sv_2cv returns a NULL pointer.
Then, CvFLAGS(cv) is used to access the flags field of a nonexistent
structure.

Sorry, I have no idea what to patch here. Holding for the Gurus ... ;-)
Probably this should be caught in perl_call_handler().

Lupe Christoph

PS: mod_perl is compiler with USE_APACI=1 EVERYTHING=1 PERL_TRACE=1
-- 
| [EMAIL PROTECTED]   |http://free.prohosting.com/~lupe |
| "jryy vg ybbxf yvxr gur l2x oht qvqa'g erne vg'f htyl urnq." "lrc. gur |
| qbbzfnlref unir orra cebira jebat lrg ntnva."    "qvq lbh frr gung |
| gbb?" "ubhfgba. jr unir n ceboyrz."   User Friendly 2000-01-01 |



RE: How to close connect and continue processing?

2000-09-14 Thread Stas Bekman

On Thu, 14 Sep 2000, Vladislav Safronov wrote:

> I read the guide and I think the best is just add "&" :)
> (how could I forget it!)
>   ..
>   system("myprog la la &");
>   print "";
>   # end

True, but what happens if your program tries to print something. You've
all in/out/err streams inherited, where in/out are tied to a socket. You
must close them at the beginning of the external script.

Anyway, it might be neater to use &, but performance wise is not, since
you spawn a shell. Of course for the heavily loaded systems. Fork is
faster.

> 
> 
> > On Thu, 14 Sep 2000, Matt Sergeant wrote:
> > 
> > > On Thu, 14 Sep 2000, Matt Sergeant wrote:
> > > 
> > > > On Thu, 14 Sep 2000, Vladislav Safronov wrote:
> > > > 
> > > > > Hi,
> > > > > 
> > > > > After user request my script should say that the 
> > request is accepted and
> > > > > continue processing user data (it takes a time) so I 
> > want to tell the
> > > > > browser
> > > > > that all data is sent. I searched mod_perl guide but I 
> > didn't find such code
> > > > > snippet.
> > > > > Could you send me such example?
> > > > 
> > > > $r->register_cleanup(\&do_big_work);
> > > 
> > > I should have mentioned that this is far from a perfect 
> > solution (cue
> > > Stas) as it ties up a mod_perl process. See the guide for alternate
> > > solutions.
> > 
> > Like Matt has said, this used mostly for light things like logging or
> > process killing (Apache::{SizeLimit|GTopLimit}). See the performance
> > chapter for forking techniques for heavy jobs:
> > http://perl.apache.org/guide/performance.html#Forking_and_Exec
> > uting_Subprocess
> > 
> > 
> > > 
> > > -- 
> > > 
> > > 
> > > Fastnet Software Ltd. High Performance Web Specialists
> > > Providing mod_perl, XML, Sybase and Oracle solutions
> > > Email for training and consultancy availability.
> > > http://sergeant.org | AxKit: http://axkit.org
> > > 
> > > 
> > 
> > 
> > 
> > _
> > Stas Bekman  JAm_pH --   Just Another mod_perl Hacker
> > http://stason.org/   mod_perl Guide  http://perl.apache.org/guide 
> > mailto:[EMAIL PROTECTED]   http://apachetoday.com http://jazzvalley.com
> > http://singlesheaven.com http://perlmonth.com   perl.org   apache.org
> > 
> > 
> 



_
Stas Bekman  JAm_pH --   Just Another mod_perl Hacker
http://stason.org/   mod_perl Guide  http://perl.apache.org/guide 
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://jazzvalley.com
http://singlesheaven.com http://perlmonth.com   perl.org   apache.org





RE: How to close connect and continue processing?

2000-09-14 Thread Vladislav Safronov

I read the guide and I think the best is just add "&" :)
(how could I forget it!)
..
system("myprog la la &");
print "";
# end


> On Thu, 14 Sep 2000, Matt Sergeant wrote:
> 
> > On Thu, 14 Sep 2000, Matt Sergeant wrote:
> > 
> > > On Thu, 14 Sep 2000, Vladislav Safronov wrote:
> > > 
> > > > Hi,
> > > > 
> > > > After user request my script should say that the 
> request is accepted and
> > > > continue processing user data (it takes a time) so I 
> want to tell the
> > > > browser
> > > > that all data is sent. I searched mod_perl guide but I 
> didn't find such code
> > > > snippet.
> > > > Could you send me such example?
> > > 
> > > $r->register_cleanup(\&do_big_work);
> > 
> > I should have mentioned that this is far from a perfect 
> solution (cue
> > Stas) as it ties up a mod_perl process. See the guide for alternate
> > solutions.
> 
> Like Matt has said, this used mostly for light things like logging or
> process killing (Apache::{SizeLimit|GTopLimit}). See the performance
> chapter for forking techniques for heavy jobs:
> http://perl.apache.org/guide/performance.html#Forking_and_Exec
> uting_Subprocess
> 
> 
> > 
> > -- 
> > 
> > 
> > Fastnet Software Ltd. High Performance Web Specialists
> > Providing mod_perl, XML, Sybase and Oracle solutions
> > Email for training and consultancy availability.
> > http://sergeant.org | AxKit: http://axkit.org
> > 
> > 
> 
> 
> 
> _
> Stas Bekman  JAm_pH --   Just Another mod_perl Hacker
> http://stason.org/   mod_perl Guide  http://perl.apache.org/guide 
> mailto:[EMAIL PROTECTED]   http://apachetoday.com http://jazzvalley.com
> http://singlesheaven.com http://perlmonth.com   perl.org   apache.org
> 
> 



Re: How to close connect and continue processing?

2000-09-14 Thread Stas Bekman

On Thu, 14 Sep 2000, Matt Sergeant wrote:

> On Thu, 14 Sep 2000, Matt Sergeant wrote:
> 
> > On Thu, 14 Sep 2000, Vladislav Safronov wrote:
> > 
> > > Hi,
> > > 
> > > After user request my script should say that the request is accepted and
> > > continue processing user data (it takes a time) so I want to tell the
> > > browser
> > > that all data is sent. I searched mod_perl guide but I didn't find such code
> > > snippet.
> > > Could you send me such example?
> > 
> > $r->register_cleanup(\&do_big_work);
> 
> I should have mentioned that this is far from a perfect solution (cue
> Stas) as it ties up a mod_perl process. See the guide for alternate
> solutions.

Like Matt has said, this used mostly for light things like logging or
process killing (Apache::{SizeLimit|GTopLimit}). See the performance
chapter for forking techniques for heavy jobs:
http://perl.apache.org/guide/performance.html#Forking_and_Executing_Subprocess


> 
> -- 
> 
> 
> Fastnet Software Ltd. High Performance Web Specialists
> Providing mod_perl, XML, Sybase and Oracle solutions
> Email for training and consultancy availability.
> http://sergeant.org | AxKit: http://axkit.org
> 
> 



_
Stas Bekman  JAm_pH --   Just Another mod_perl Hacker
http://stason.org/   mod_perl Guide  http://perl.apache.org/guide 
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://jazzvalley.com
http://singlesheaven.com http://perlmonth.com   perl.org   apache.org





Re: Apache::ASP problem

2000-09-14 Thread Rod Butcher

I believe you have actually specified that the pages must be served out of a
directory /asp/ ... irrespective of the .asp suffix.
If you want to drive it by suffixes not directories I suggest you try

AddType text/html .asp

 SetHandler perl-script
 PerlHandler Apache::ASP


(remove htm etc if you don't want them parsed by Apache::ASP). This method
is less restrictive in that it allows you to keep binaries etc in the same
directories with confusing Apache::ASP.

This will also handle the scenario where the url from the browser does not
contain the .asp suffix, i.e. the client wants the index page.

Rod
- Original Message -
From: "Sophokles Zafeiris" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 14, 2000 6:37 PM
Subject: Apache::ASP problem


> I have an Apache server version 1.3.12 installed on a solaris machine.
> I'm trying to make ASP's work. I installed the mod_perl and the
> Apache::ASP and I added in the httpd.conf file the followin directive
>   
>SetHandler perl-script
>PerlHandler Apache::ASP
>PerlSetVar Global /tmp
>   
>
> but the ASP's do not work. Actually the server handles the .asp files as
> if they were text files (I get the source on my browser's window).
>
> Is there something that I could do?
>
> Sofoklis
>
>





Re: How to close connect and continue processing?

2000-09-14 Thread Matt Sergeant

On Thu, 14 Sep 2000, Matt Sergeant wrote:

> On Thu, 14 Sep 2000, Vladislav Safronov wrote:
> 
> > Hi,
> > 
> > After user request my script should say that the request is accepted and
> > continue processing user data (it takes a time) so I want to tell the
> > browser
> > that all data is sent. I searched mod_perl guide but I didn't find such code
> > snippet.
> > Could you send me such example?
> 
> $r->register_cleanup(\&do_big_work);

I should have mentioned that this is far from a perfect solution (cue
Stas) as it ties up a mod_perl process. See the guide for alternate
solutions.

-- 


Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org | AxKit: http://axkit.org




Re: How to close connect and continue processing?

2000-09-14 Thread Matt Sergeant

On Thu, 14 Sep 2000, Vladislav Safronov wrote:

> Hi,
> 
> After user request my script should say that the request is accepted and
> continue processing user data (it takes a time) so I want to tell the
> browser
> that all data is sent. I searched mod_perl guide but I didn't find such code
> snippet.
> Could you send me such example?

$r->register_cleanup(\&do_big_work);

-- 


Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org | AxKit: http://axkit.org




How to close connect and continue processing?

2000-09-14 Thread Vladislav Safronov

Hi,

After user request my script should say that the request is accepted and
continue processing user data (it takes a time) so I want to tell the
browser
that all data is sent. I searched mod_perl guide but I didn't find such code
snippet.
Could you send me such example?

==

Vlad.






Apache::ASP problem

2000-09-14 Thread Sophokles Zafeiris

I have an Apache server version 1.3.12 installed on a solaris machine.
I'm trying to make ASP's work. I installed the mod_perl and the
Apache::ASP and I added in the httpd.conf file the followin directive
  
   SetHandler perl-script
   PerlHandler Apache::ASP
   PerlSetVar Global /tmp
  

but the ASP's do not work. Actually the server handles the .asp files as
if they were text files (I get the source on my browser's window).

Is there something that I could do?

Sofoklis




Re: Apache::PerlRun::Flush

2000-09-14 Thread Stas Bekman

On Wed, 13 Sep 2000, Andrew Chen wrote:

> Hello all,
> 
> There was some discussion about the Apache::PerlRun::Flush handler before,
> but here's a quick refresher: the handler was written in order to be able
> to run dirty code on PerlRun with PerlRunOnce Off by going through and
> cleaning up the memory space between each request. It's been working okay,
> and we're putting it through QA right now.
> 
> Some people have e-mailed and asked about open sourcing of the handler,
> and all I can say is: It will be done, I'm just not sure when. This will
> be the first piece of software open sourced here at Cobalt, and it just
> needs to go through the right channels. By the way, is having "Apache" in
> the name of the package a problem?

Use the "Apache" name is a sensitive issue in general. But it's
abosolutely Ok to release your modules under Apache:: tree.



_
Stas Bekman  JAm_pH --   Just Another mod_perl Hacker
http://stason.org/   mod_perl Guide  http://perl.apache.org/guide 
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://jazzvalley.com
http://singlesheaven.com http://perlmonth.com   perl.org   apache.org





RE: ActivePerl 617 and GD.ppd

2000-09-14 Thread Matt Sergeant

On Thu, 14 Sep 2000, Foo, Ji Haw wrote:

> Did exactly that. Which is why I was surprised that build 522 works well but
> not 617. Keeps telling me I got the wrong platform.

Ah, maybe ppm's have started specifying the architecture too (I was always
bugging them about that)... Check the ppd file, it should be obvious.

-- 


Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org | AxKit: http://axkit.org




RE: ActivePerl 617 and GD.ppd

2000-09-14 Thread Foo, Ji Haw

Did exactly that. Which is why I was surprised that build 522 works well but
not 617. Keeps telling me I got the wrong platform.

regards,

Ji-Haw, Foo
Network Engineer (AP)


-Original Message-
From: Matt Sergeant [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 14, 2000 3:44 PM
To: Foo, Ji Haw
Cc: 'Randy Kobes'; [EMAIL PROTECTED]
Subject: Re: ActivePerl 617 and GD.ppd


On Wed, 13 Sep 2000, Foo, Ji Haw wrote:

> I tried to install gd (http://www.activestate.com/packages) on build 617,
> but it keeps telling me:
> Error installing package 'GD.ppd': Could not locate a PPM binary of
'GD.ppd'
> for this platform.
> 
> This same package works well for build 522 (which is why I am still using
> build 522). I would like to try upgrade to 617, but this problem is
bugging
> me. Any suggestions?
> 
> Btw, I had to download the gd.ppd as well as the corresponding zips/ and
> x86/ files into my own machine because of firewall issues.

Say you put the ppd file in C:/temp, then you will need to put the
corresponding .tar.gz file in C:/temp/x86 for ppm to work right. At least
I think thats how it works...

-- 


Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org | AxKit: http://axkit.org



Re: ActivePerl 617 and GD.ppd

2000-09-14 Thread Matt Sergeant

On Wed, 13 Sep 2000, Foo, Ji Haw wrote:

> I tried to install gd (http://www.activestate.com/packages) on build 617,
> but it keeps telling me:
> Error installing package 'GD.ppd': Could not locate a PPM binary of 'GD.ppd'
> for this platform.
> 
> This same package works well for build 522 (which is why I am still using
> build 522). I would like to try upgrade to 617, but this problem is bugging
> me. Any suggestions?
> 
> Btw, I had to download the gd.ppd as well as the corresponding zips/ and
> x86/ files into my own machine because of firewall issues.

Say you put the ppd file in C:/temp, then you will need to put the
corresponding .tar.gz file in C:/temp/x86 for ppm to work right. At least
I think thats how it works...

-- 


Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org | AxKit: http://axkit.org