[mp1] Apache::CmdParms->server()
Hi list,
I wrote an Apache Configuration Directive which works fine. Now it
should also work with VirtualHosts so I try to use the following
borrowed from 'Writing Apache Modules with Perl and C':
sub PerlMIHConfig ($$$) {
my($cfg, $parms, $file) = @_;
my $scfg = Apache::ModuleConfig->get($parms->server());
}
Can't locate object method "server" via package "Apache::CmdParms" at
/usr/local/lib/perl/5.8.0/Apache/MIHConfig.pm line 35.
Am I missing something or could someone give me a hint where to find the
Apache::CmdParms doku (seems to come none with my installation ;-)
Thanx in advance.
--
[EMAIL PROTECTED]
--plan-b.-GmbH--http://www.planb.de/--
--Rueppurrer-Str.-4-T#-49-721-35489964
--76317-Karlsruhe---F#-49-721-388581--
smime.p7s
Description: S/MIME Cryptographic Signature
Re: [mp1] Apache::CmdParms->server()
Thomas Nagel wrote:
Hi list,
I wrote an Apache Configuration Directive which works fine. Now it
should also work with VirtualHosts so I try to use the following
borrowed from 'Writing Apache Modules with Perl and C':
sub PerlMIHConfig ($$$) {
my($cfg, $parms, $file) = @_;
my $scfg = Apache::ModuleConfig->get($parms->server());
}
that looks just fine to me. you shouldn't need it, but try to
use Apache::CmdParms;
at the top of your script, just in case.
Can't locate object method "server" via package "Apache::CmdParms" at
/usr/local/lib/perl/5.8.0/Apache/MIHConfig.pm line 35.
Am I missing something or could someone give me a hint where to find the
Apache::CmdParms doku (seems to come none with my installation ;-)
recipes 7.8, 7.9, and (specfically) 7.10 in the mod_perl developer's
cookbook talk about Apache::CmdParms, so that might help.
http://www.modperlcookbook.org/chapters/ch07.pdf
--Geoff
Re: Apache-AuthenNTLM-2.04
Keven Murphy wrote: Shannon, I am trying to get your module to work with Apache 1.2.28 & mod_perl 1.28. I am getting the error below. Any idea what it means? The server is only accepting NTLMv2. It would appear to me that the module does not support that version yet. Thank you for any help, K Murphy [EMAIL PROTECTED] [13573] AuthenNTLM: Start NTLM Authen handler pid = 13573, connection = 135651588 conn_http_hdr = keep-alive main = cuser = remote_ip = 192.1.69.6 remote_port = remote_host = <> version = 2.04 [13573] AuthenNTLM: Setup new object [13573] AuthenNTLM: Config Domain = ls pdc = 192.1.4.6 bdc = 192.1.4.7 [13573] AuthenNTLM: Config Default Domain = LS [13573] AuthenNTLM: Config Fallback Domain = [13573] AuthenNTLM: Config AuthType = ntlm,basic AuthName = QAAR LS DOMAIN Directory Authentication [13573] AuthenNTLM: Config Auth NTLM = 1 Auth Basic = 1 [13573] AuthenNTLM: Config NTLMAuthoritative = off BasicAuthoritative = off [13573] AuthenNTLM: Config Semaphore key = 23754 timeout = 2 [13573] AuthenNTLM: Authorization Header Basic [13573] AuthenNTLM: basic auth username = LS\murphyk [13573] AuthenNTLM: Connect to pdc = 192.1.4.6 bdc = 192.1.4.7 domain = ls [13573] AuthenNTLM: enter lock [Wed Oct 8 15:16:00 2003] [error] access to / failed for , reason: Connect to SMB Server faild (pdc = 192.1.4.6 bdc = 192.1.4.7 domain = ls error = -11/0) for / [13573] AuthenNTLM: leave lock [Wed Oct 8 15:16:00 2003] [error] access to / failed for , reason: Cannot get nonce for / Hi! You are making me dust off the cobwebs!!! ;) Anyways, I think that the problem is not the version of NTLM, but the browser that you are using. Your browser is sending: [13573] AuthenNTLM: Authorization Header Basic When it should be sending something like: [505] AuthenNTLM: Authorization Header NTLM TlRMTVNTUAABB4IAoAB= It looks to me as if you are not using Internet Explorer... What happens when you try it from IE? speeves cws
RE: Using class wide variables under mod_perl is safe?
On Thu, 2003-10-09 at 00:56, Morton-Allen, Matt wrote:
> I should have also mentioned that not only does the "returned" come back
> out of order there are also more than there should be. There's 3 calls
> and 4 results.
Then there's probably another call that you didn't notice.
> Worse it now appears that if I hit the server long enough to come back
> to the same process the value has stayed put. I assume this is why the
> suggested use of $r->pnotes?
Right.
> If so how do I get access to $r (which is shifted off early in the .pl)
> when this is deep within a module (without a global that is)?
Well, again, there's nothing wrong with globals when used carefully, and
this solution does use them for storing things.
If you're using mod_perl 1, you can do this to get $r:
my $r = Apache->request();
If you're using mod_perl 2, you can do this:
# in your handler
my $r = shift;
Matt::Resources->set_req($r);
# in Matt::Resources
our $r;
sub set_req {
$r = shift;
}
sub get_dbh {
if (!$r->pnotes('dbh')) {
my $dbh = DBI->connect...
$r->pnotes('dbh', $dbh);
}
return $r->pnotes('dbh');
}
- Perrin
Re: Using class wide variables under mod_perl is safe?
Perrin Harkins wrote: [...] Well, again, there's nothing wrong with globals when used carefully, and this solution does use them for storing things. If you're using mod_perl 1, you can do this to get $r: my $r = Apache->request(); If you're using mod_perl 2, you can do this: You can do the same with mp2. As long as running under 'SetHandler perl-script' or having 'PerlOptions +GlobalRequest', though it will be available only during the response handler. # in your handler my $r = shift; Matt::Resources->set_req($r); BTW, that's what newer CGI.pm versions support. You can now pass $r to the CGI::new() method, so you don't have to rely on Apache->request(); being available. __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Using class wide variables under mod_perl is safe?
On Thu, 2003-10-09 at 12:58, Stas Bekman wrote: > You can do the same with mp2. As long as running under 'SetHandler > perl-script' or having 'PerlOptions +GlobalRequest', though it will be > available only during the response handler. Isn't it deprecated though, because of performance? - Perrin
Re: Using class wide variables under mod_perl is safe?
Perrin Harkins wrote: On Thu, 2003-10-09 at 12:58, Stas Bekman wrote: You can do the same with mp2. As long as running under 'SetHandler perl-script' or having 'PerlOptions +GlobalRequest', though it will be available only during the response handler. Isn't it deprecated though, because of performance? You are correct. It is deprecated. Though, it really affects threaded mpms, but since we want all modules to run indentically under any mpm, it's extended to all of them. Though if someone writes their internal code (not a CPAN module), they may choose to stick with prefork and then they don't have the performance impact. I suppose a clarification on this issue is needed in the docs, patches are very welcome. __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
OT: high availability/load balancing solutions
My site doesn't require high performance as in thousands or even hundreds of requests per second, but we do need the reliability in order to stay in the game. And I don't have a five figure budget to play with. But my needs are simple: just keep the site (both HTTP and SSL) up and running as long as we have connectivity. Similar material gets covered in the mod_perl guide, so I'm not wandering too far afield. I think. I have 2 options I've come up with: 1) Build a couple of Linux router/firewall boxes using Linux HA tools like heartbeat and fake (IP address takeover) along with IPtables. Spend many days making it all work together (well that's what it looks like from not having done it + previous experience from learning new software). 2) Buy a couple of used first generation Radware web server directors on the cheap. With any luck, they arrive in working order and do what I want with trivial amounts of effort (again that's a fairly ignorant evaluation). Interestingly enough, no information on the models I can afford shows up on Radware's site. Who's done this sort of thing, that can clue me in to what I probably don't know about this topic.
Re: OT: high availability/load balancing solutions
There is a special list for this topic, see: http://perl.apache.org/docs/offsite/other.html#Performance_and_Scalability __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Apache::DBI & Oracle Not Reconnecting
Hello, Excuse me if there is a better list for this but... Every time I reboot my Oracle database, my mod_perl server is not able to connect to the db until I restart the apache server. I am using Oracle 9.12, Apache::DBI 0.92, Apache 1.3.28. I get the following entry in the Apache error log: DBD::Oracle::st execute failed: ORA-03114: not connected to ORACLE (DBD ERROR: OCIStmtExecute) [for Statement " BEGIN :amt := RA_TEST.CURRENCY_CONVERT(56, 8, 1, '31-MAY-03'); END; " with ParamValues: :amt=undef] at /perl_modules/CurrencyManager.pm line 58. My understanding is that Apache::DBI is supposed to establish a new connection if the cached connection is invalid. Any thoughts on this would be great. Thanks, Levon Barker
open(STDERR, ">&STDOUT") not working
I had the following in wdbi.cgi that failed: open(STDERR, ">&STDOUT") || die "Can't dup stdout: $!\n" In Apache's error_log, i have: ModPerl::Registry: $r wasn't passed at... Any ideas what went wrong? many many thanx. :)Kelly
Re: open(STDERR, ">&STDOUT") not working
Kelly Zeng wrote: > I had the following in wdbi.cgi that failed: > open(STDERR, ">&STDOUT") || die "Can't dup stdout: $!\n" > In Apache's error_log, i have: > ModPerl::Registry: $r wasn't passed at... > > Any ideas what went wrong? We can't help you here as you provided too little information. Please see http://perl.apache.org/bugs/ and make sure that you post a sample code that produces this problem and the *complete* error message. Thanks. __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
RE: Using class wide variables under mod_perl is safe?
I'm still concerned about the 4 responses for only 3 calls as I am
certain there are only 3. I've been playing with this in a very small
program so it's hard to miss any.
I was thinking overnight and the only thing I could come up with was
that the pre-loading I'm doing in the traditional startup.pl might be
having some effect. Is this possible?
> -Original Message-
> From: Perrin Harkins [mailto:[EMAIL PROTECTED]
> Sent: Friday, 10 October 2003 1:36 AM
> To: Morton-Allen, Matt
> Cc: [EMAIL PROTECTED]
> Subject: RE: Using class wide variables under mod_perl is safe?
>
> On Thu, 2003-10-09 at 00:56, Morton-Allen, Matt wrote:
> > I should have also mentioned that not only does the "returned" come
back
> > out of order there are also more than there should be. There's 3
calls
> > and 4 results.
>
> Then there's probably another call that you didn't notice.
>
> > Worse it now appears that if I hit the server long enough to come
back
> > to the same process the value has stayed put. I assume this is why
the
> > suggested use of $r->pnotes?
>
> Right.
>
> > If so how do I get access to $r (which is shifted off early in the
.pl)
> > when this is deep within a module (without a global that is)?
>
> Well, again, there's nothing wrong with globals when used carefully,
and
> this solution does use them for storing things.
>
> If you're using mod_perl 1, you can do this to get $r:
>
> my $r = Apache->request();
>
> If you're using mod_perl 2, you can do this:
>
> # in your handler
> my $r = shift;
> Matt::Resources->set_req($r);
>
> # in Matt::Resources
> our $r;
> sub set_req {
> $r = shift;
> }
>
> sub get_dbh {
> if (!$r->pnotes('dbh')) {
> my $dbh = DBI->connect...
> $r->pnotes('dbh', $dbh);
> }
> return $r->pnotes('dbh');
> }
>
> - Perrin
RE: Using class wide variables under mod_perl is safe?
On Thu, 2003-10-09 at 18:03, Morton-Allen, Matt wrote: > I was thinking overnight and the only thing I could come up with was > that the pre-loading I'm doing in the traditional startup.pl might be > having some effect. Is this possible? Sure. If you want to know what is calling your sub, you can use Devel::StackTrace or Carp. - Perrin
RE: Using class wide variables under mod_perl is safe?
Ok, much joy and happiness, it works (not that I doubted you!). For now
I have taken out the pre-loading as it seems to result in deep voodoo
that I don't claim to understand.
One last question, which I am certain is obvious but is passing me by.
How can I get this to work under CGI? As I mentioned earlier I tend to
use CGI for early development so I know what I am dealing with.
Matt.
> -Original Message-
> From: Perrin Harkins [mailto:[EMAIL PROTECTED]
> Sent: Friday, 10 October 2003 1:36 AM
> To: Morton-Allen, Matt
> Cc: [EMAIL PROTECTED]
> Subject: RE: Using class wide variables under mod_perl is safe?
>
> On Thu, 2003-10-09 at 00:56, Morton-Allen, Matt wrote:
> > I should have also mentioned that not only does the "returned" come
back
> > out of order there are also more than there should be. There's 3
calls
> > and 4 results.
>
> Then there's probably another call that you didn't notice.
>
> > Worse it now appears that if I hit the server long enough to come
back
> > to the same process the value has stayed put. I assume this is why
the
> > suggested use of $r->pnotes?
>
> Right.
>
> > If so how do I get access to $r (which is shifted off early in the
.pl)
> > when this is deep within a module (without a global that is)?
>
> Well, again, there's nothing wrong with globals when used carefully,
and
> this solution does use them for storing things.
>
> If you're using mod_perl 1, you can do this to get $r:
>
> my $r = Apache->request();
>
> If you're using mod_perl 2, you can do this:
>
> # in your handler
> my $r = shift;
> Matt::Resources->set_req($r);
>
> # in Matt::Resources
> our $r;
> sub set_req {
> $r = shift;
> }
>
> sub get_dbh {
> if (!$r->pnotes('dbh')) {
> my $dbh = DBI->connect...
> $r->pnotes('dbh', $dbh);
> }
> return $r->pnotes('dbh');
> }
>
> - Perrin
