Re: prob with dir_config at server startup

2001-01-02 Thread John K Sterling

the per_dir_configs (i.e.  PerlSetVar) are not accessabled from
the Apache::Server.  They are only accessable from
Apache::Request::dir_config.  It makes sense if you think about it - a
per_dir config can be different for each Location.  If you need any config
values in a PerlInitHandler, you need to specify them outside the location
tags.

sterling

"T.J. Mather" wrote:

> I'm having a problem accessing PerlSetVar variables with
> Apache->server->dir_config at server startup.  I'm using the lastest
> versions of mod_perl 1.24_01 and apache (1.3.14).
>
> The problem occurs when I use PerlSetVar inside a Directory, Location or
> Files section:
>
> in httpd.conf:
> 
> PerlSetVar PKIT_ROOT /home/tjmather/Apache-PageKit/eg
> 
>
> perl startup code:
> my $pkit_root = Apache->server->dir_config('PKIT_ROOT');
> # $pkit_root = undef
>
> But if I remove the Location directive, then it works fine:
>
> in httpd.conf:
> PerlSetVar PKIT_ROOT /home/tjmather/Apache-PageKit/eg
>
> perl startup code:
> my $pkit_root = Apache->server->dir_config('PKIT_ROOT');
> # $pkit_root = '/home/tjmather/Apache-PageKit/eg'
>
> Any ideas?




Re: PerlSetupEnv Off not working

2001-01-02 Thread John K Sterling

i assume thats a typo, i think PerlSetupEnv has been in since '96

have you seen this bug report? 
http://marc.theaimsgroup.com/?l=apache-modperl&m=95867712412668&w=2
might have something to do with it.

sterling

JR Mayberry wrote:

> Perhaps the problem is that the page reads...
>
> PerlSetupEnv Off is another optimization you might consider. This
> directive requires mod_perl 1.25 or later.
>
> but I run mod_perl 1.24, but http://perl.apache.org/dist/ makes no
> reference to mod_perl 1.25
>
> ?
>
> John K Sterling wrote:
> >
> > check the guide:
> > http://thingy.kcilink.com/modperlguide/performance/PerlSetupEnv_Off.html
> >
> > > But %ENV population is expensive. Those who have moved to the Perl Apache API no 
>longer need this extra %ENV
> > > population, and can gain by turning it Off. Scripts using the CGI.pm module 
>require PerlSetupEnv On because that
> > > module relies on a properly populated CGI environment table.
> > >
> > 
>___
> >
> > JR Mayberry wrote:
> >
> > > Perhaps I am a bit confused about how this should be working...but..
> > >
> > > I have PerlSetupEnv set to Off in httpd.conf..
> > >
> > > yet in this sample script running as an Apache::Registry script:
> > >
> > > #!/opt/bin/perl
> > >
> > > use Data::Dumper;
> > > my $r = Apache->request();
> > > $r->send_http_header('text/plain');
> > > print Dumper(\%ENV);
> > >
> > > its dumping out what appears to be a complete enviroment..
> > >
> > > what gives, shouldnt this be empty?
> > >
> > > there are some other Apache::Registry scripts which havent been
> > > re-written to not use CGI.pm anymore, is it possible that 'use'ing
> > > CGI.pm;' is forcing this to be turned back on?
> > >
> > > -confused
> > >
> > > --
>
> --
> __
> JR Mayberry e-Vend.net Corporation
> Programmer and Systems Administrator(888) 427-8743 x226 tel
> [EMAIL PROTECTED]http://www.e-vend.net
>
> 
> The information in this message (including attachments) is confidential.
> If the reader of this message is not the intended recipient or an agent
> responsible for delivering it to the intended recipient, you are hereby
> notified that you have received this document in error and that any
> review, dissemination, distribution, or copying of this message is
> strictly prohibited.  If you have received this communication in error,
> please notify us immediately by e-mail, and delete the original message.
> ***




Re: PerlSetupEnv Off not working

2001-01-02 Thread John K Sterling

check the guide:
http://thingy.kcilink.com/modperlguide/performance/PerlSetupEnv_Off.html



> But %ENV population is expensive. Those who have moved to the Perl Apache API no 
>longer need this extra %ENV
> population, and can gain by turning it Off. Scripts using the CGI.pm module require 
>PerlSetupEnv On because that
> module relies on a properly populated CGI environment table.
>
___

JR Mayberry wrote:

> Perhaps I am a bit confused about how this should be working...but..
>
> I have PerlSetupEnv set to Off in httpd.conf..
>
> yet in this sample script running as an Apache::Registry script:
>
> #!/opt/bin/perl
>
> use Data::Dumper;
> my $r = Apache->request();
> $r->send_http_header('text/plain');
> print Dumper(\%ENV);
>
> its dumping out what appears to be a complete enviroment..
>
> what gives, shouldnt this be empty?
>
> there are some other Apache::Registry scripts which havent been
> re-written to not use CGI.pm anymore, is it possible that 'use'ing
> CGI.pm;' is forcing this to be turned back on?
>
> -confused
>
> --




Re: LWP and HTML::HeadParser....failed

2001-01-02 Thread John K Sterling

Yung Kwong Wing wrote:

>
> "[thekid@visors thekid]# perl -MCPAN -install LWP
> Can't open perl script "LWP": No such file or directory"

try:
perl -MCPAN -e 'install "LWP"'

sterling




Re: do I really need "mod_perl"

2000-12-30 Thread John K Sterling

read this: http://take23.org/whatis_mod_perl.xml

it should explain all.

sterling


Yung Kwong Wing wrote:

> Hi,
>
> Sorry for asking a stupid question, but I was wondering do I really need
> to install "mod_perl" to get my website to work with CGI.
>
> It seems that after my unsuccessful attempt at installing "mod_perl", I
> can use the Perl interpreter just fine and I can use the CGI-bin just fine
> also.
>
> I have placed my observations and records in the following URL:
> http://home.netvigator.com/~yungp/my_perl.html
>
> If you look at the observations and records under the date "Dec 30, 2000",
> you will see the modules that are currently installed and that my CGI
> works just fine without "mod_perl"
>
> If anyone can shed the light on this mystery to me, it would be greatly
> appreciated.
>
> Thanks
>
> Peter




Re: Proposals for ApacheCon 2001 in; help us choose! (fwd)

2000-12-21 Thread John K Sterling

> At 02:22 AM 12/22/00 +0100, Stas Bekman wrote:
>
> >Well, this is new. You choose what sessions at ApacheCon you want.
> >
> >I don't think it's a fair approach by ApacheCon committee, as by applying
> >this approach they are going to make the big player even bigger and kill
> >the emerging technologies, who will definitely not get enough quotes and
> >thus will not make it in :( I'm not on the committee, so I cannot really
> >influence, but I'll try anyway.
> >

you don't want a little say in things? i think its clear that they are not
going to just pick the speaker by the number of votes they get.  its just a
great way to allow the people who are going to be at apachecon to put their 2
cents in on what is going to be there.  if anything it gives the public more
say.  the group is obviously interested in picking new diverse topics, but they
also want feedback.

sterling





Re: mod_perl in a shared hosting environment

2000-12-10 Thread John K. Sterling


yes - check out http://perl.apache.org/~dougm/modperl_2.0.html

sterling

 On
10 Dec 2000, David Hodgkinson wrote:

> 
> Just a thought, but will mod_perl and Apache 2.0 be better for this?
> Will we be able to isolate different hosts' perl more easily?
> 
> 




Re: [OT] mod_motd

2000-12-07 Thread John K. Sterling

I think there's a Apache::Motd perl module, is that what your looking for?

sterling

On Thu, 7 Dec 2000, Jerrad Pierce wrote:

> Am I losing my mind or is there a mod_motd for Apache floating around?
> I haven't been able to find it anywhere, but I'm sure I've seen it.
> (Checked Freshmeat, search engines, and Apache module repository)
> 
> Thanks
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: mod_perl with threaded Apache (eg Apache2)

2000-12-04 Thread John K. Sterling

This is doug macEachern's bag -

those who were at apachecon in london saw the progress he had made at that
point - its pretty sweet.  check the archives for summaries of his
presentation in late october.

sterling

On Mon, 4 Dec 2000, Robbie Lindauer wrote:

> Is anyone working on an upgrade to mod_perl to
> handle Apache 2.0b with thread support?
> 
> If so, do you want my help?
> 
> If not, does anyone want to help me?
> 
> Robbie Lindauer
> 
> =
> Robbie Lindauer
> To quote Heidegger:
> 
> "Existence is a mode of being, specifically, the being of 
> those being who stand for the openess of being by standing 
> in it."
> 
> 
> __
> Do You Yahoo!?
> Yahoo! Shopping - Thousands of Stores. Millions of Products.
> http://shopping.yahoo.com/
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: configuration file ( startup.pl )!!!

2000-11-20 Thread John K. Sterling

The below code in your startup.pl will have 1 connection per child.  If
you're apache config allows for 20 kids, each one will get its own
connection to your database.  There is no built in pooling support (though
that will be trivial in 2.0) but usually having a connection per kid is
what you're looking for.


sterling


On Mon, 20 Nov 2000, Edmar Edilton da Silva wrote:

> Dear all,
> 
> I am with a small problem. I used the following command to open some
> 
> connections when the WWW server is initialized:
> 
> #Initialize the database connections for each child
> Apache::DBI->connect_on_init
> ("dbi:Oracle:ora8", "travel", "travel",
>{
>PrintError => 1, # Warn() on errors
>RaiseError => 0, # Don't die on error
>AutoCommit => 1, # Commit executes immediately
>}
> );
> 
> The problem is which I do not know how to configure the WWW server
> 
> to open many connections for example "20 connections"!!!
> 
> Can anyone help me ? If possible, I would like someone send me your
> 
> configuration file (startup.pl).
> 
> Thanks,
> 
> 
> 
> Edmar Edilton da Silva
> Bacharel em Ciência da Computacão - UFV
>   Mestrando em Ciência da Computacão - UNICAMP
> 
> 
> 
> 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: return from nested functions

2000-11-01 Thread John K. Sterling

On Wed, 1 Nov 2000, Paul J. Lucas wrote:

> On Wed, 1 Nov 2000, John K. Sterling wrote:
> 
> > even better: Apache->exit(SERVER_ERROR);
> 
>   The documentation for exit() deosnt' explicitly say you can do
>   that.  It mentions only "0" and "DONE" (see pp. 464-465).


it works though, Apache.xs:exit() passes the status value to
perl_util.c:perl_call_halt(), which checks:
int is_http_code = 
((status >= 100) && (status < 600) && ERRSV_CAN_BE_HTTP);

...

if(is_http_code) {
croak("%d\n", status);
}

the croak() call is caught the same way 'die SERVER_ERROR' is.



> 
> > or die SERVER_ERROR;
> 
>   But that works.  Thanks!  :)
> 
>   - Paul
> 




Re: return from nested functions

2000-11-01 Thread John K. Sterling


even better: Apache->exit(SERVER_ERROR);.  or die SERVER_ERROR;. this is
documented in the eagle book:

ch9 -  The Apache::Constants Class

"...
While the HTTP constants are generally used as return codes from
handler subroutines, it is also possible to use the builtin die()
function to jump out of a handler with a status code that will be
propagated back to Apache.  Example:

 unless (-r _) {
 die FORBIDDEN;
 }
"
sterling


On Wed, 1 Nov 2000, Paul J. Lucas wrote:

> On Wed, 1 Nov 2000, Paul J. Lucas wrote:
> 
> > Ideally, I want to be able to do:
> > 
> > sub foo {
> > if ( $serious_problem )
> > stop_now_dammit( SERVER_ERROR );
> > }
> > 
> > anywhere in the code like:
> > 
> > sub bar {
> > foo();
> > }
> > 
> > and I do *NOT* have to "catch" anything after the point of
> > call, i.e., every call of foo() is similar to an "assertion" in
> > C, i.e., if you get to the line of code after it, it worked; if
> > it didn't work, you never get to the line after it.
> 
>   I figured out that I can do this by having stop_now_dammit()
>   use $r->notes() to set a note of the status code, call
>   Apache->exit(), and have the downstream handler check the note.
>   If it's anything but OK, simply return that value and the
>   normal Apache error handline mechanism kicks in.  :)
> 
>   - Paul
> 




Re: persistent database problem

2000-10-23 Thread John K. Sterling


The db connection happens once for each child - so every time you hit a
child for the first time it will open up a new connection - you probably
have apache configured to start with 4 or so kids.

sterling

 On Mon, 23 Oct 2000,
Differentiated Software Solutions Pvt. Ltd wrote:

> Hi,
> I have started with one httpd; and executed the following mod-perl program from 
>the browser. We've configured apache to have persistent DBI
> The idea is first time the database handle will be inactive and it will print 
>'INSIDE'.  From the second time onwards the database handle will be active and it 
>will print 'OUTSIDE'.  This is working.
> But, sometimes the 'OUTSIDE' comes from the third or fourth time only.  (that is 
>it takes more than one attempt to become persistent) Why it is happening like this?
> Thanks
> Muthu S Ganesh
> 
> mod-perl code is here:
> 
> $rc = $dbh_pg->{Active};
> print "$$: $rc\n";
> if($rc eq '')
> {
> print "INSIDE\n";
> $dbh_pg = 
>DBI->connect("dbi:Pg:dbname=adcept_smg_ctrl","postgres","postgres",{RaiseError => 1}) 
>|| die $DBI::errstr;
> }
> else
> {
> print "OUTSIDE\n";
> }
> 
> 
> Differentiated Software Solutions Pvt. Ltd.
> 176, Ground Floor, 6th Main,
> 2nd Block, RT Nagar
> Bangalore - 560032
> Phone : 91 80 3431470
> www.diffs-india.com
> 




[PATCH] stop win32 crash when bringing down service

2000-10-20 Thread John K. Sterling

it appears that the mp dso was being unloaded before the cleanups were
complete, causing a crash in cleanup_sv - ONLY when running as a
service.  still not sure why this happens, but this patch at least
eliminates the crash.  i believe this is only called before the process
comes down (nt service restart seems to bring the process down), so it
shouldn't really leak.

--- mod_perl.c_bk   Fri Oct 20 12:03:22 2000
+++ mod_perl.c  Fri Oct 20 12:58:52 2000
@@ -507,8 +507,20 @@
 
 static void mp_dso_unload(void *data) 
 { 
-
-array_header *librefs = xs_dl_librefs((pool *)data);
+array_header *librefs;
+#ifdef WIN32
+// This is here to stop a crash when bringing down
+// a service.  Apparently the dso is unloaded too early.
+// This if statement tests to see if we are running as a 
+// service. apache does the same
+// see apache's isProcessService() in service.c 
+if (AllocConsole())
+{
+FreeConsole();
+return;
+} 
+#endif
+librefs = xs_dl_librefs((pool *)data);
 perl_shutdown(NULL, NULL);
 unload_xs_so(librefs);