You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Vincent Moneymaker <vb...@hotmail.com> on 2005/07/01 00:03:03 UTC

Re: Apache::DBI and mod_perl 2.0.1

> Joshua Hoblitt wrote:
>
> >On Thu, Jun 30, 2005 at 11:25:26AM -0400, Philip M. Gollucci wrote:
> >
> >
> >>Mark A. Downing wrote:
> >>
> >>
> >>
> >>>On Thu, 30 Jun 2005, Philip M. Gollucci wrote:
> >>>
> >>>
> >>>
> >>>>Thanks for this Mark.  (Un)fortunately you've been beat to it and
> >>>>there are "few" more changes to
> >>>>get all of it working with mp2.
> >>>>
> >>>>
> >>>Very nice. Thanks. Can we get that pushed up to CPAN?
> >>>
> >>>
> >>Umm.... Talk to Ask B. H.  He's been a bit sparse on the responses.
> >>Granted he's very busy.
> >>
> >>I've asked 3 times now.
> >>
> >>
> >
> >I would also very much like to have connect_on_init() working under mp2.
> >
> >-J
> >
> >--
> >
> >
> http://p6m7g8.net/Apache-DBI
>
> The 0.97's connect_on_init() works under MP2.
>
> In fact p6m7g8.net is running it on a backend server.
>

I have a question which I am not sure whether it is loopy or not.

In the Apache::DBI module module the variable '$Apache::ServerStarting' is
used but I can't find any reference to it on the mod_perl site or elsewhere
under /usr/local/lib/perl5 on my FreeBSD box.  The mod_perl site refers to
an '$Apache::Server::Starting' variable but not the $Apache::ServerStarting
variable.  Is this a mistake on the mod_perl site or in the Apache::DBI code
or am I just getting confused.

http://perl.apache.org/docs/2.0/user/porting/compat.html#C__Apache__Server__Starting__and_C__Apache__Server__ReStarting_

Thanks, Vince Moneymaker



Re: Apache::DBI and mod_perl 2.0.1

Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
Philip M. Gollucci wrote:

> Vincent Moneymaker wrote:
>
> From Apache::DBI:
>
> > if ($Apache::ServerStarting and $Apache::ServerStarting == 1) {
> >        print STDERR "$prefix skipping connection during server 
> startup, read the docu !!\n" if $Apache::DBI::DEBUG > 1;
> >        return $drh->connect(@args);
> >    }
>
PATCHED and AVAILABE as 0.98

http://p6m7g8.net/Apache-DBI

Changes:
    0.98   06/30/2005
           - Fix MP2 issue with $Apache::Server::Starting
           Reported by Vincent Moneymaker vbmonymaker (at) hotmail (dot) com
           [Philip M. Gollucci <pgollucci (at) p6m7g8 (dot) com>

HTH

-- 
END 
---------------------------------------------------------
    What doesn't kill us can only make us stronger.
               Nothing is impossible.
				
Philip M. Gollucci (pgollucci@p6m7g8.com) 301.254.5198
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Developer / Liquidity Services, Inc.
     http://www.liquidityservicesinc.com
        http://www.liquidation.com
        http://www.uksurplus.com
        http://www.govliquidation.com
        http://www.gowholesale.com



Re: Apache::DBI and mod_perl 2.0.1

Posted by Vincent Moneymaker <vb...@hotmail.com>.
Philip G. Gollucci wrote:
>You are correct in what it does; however, its not an issue as far as I can 
>see.  The reason being is that the last arg of connect is the \%attrs hash 
>ref.  Its replacing the password with *'s and then showing all SCALAR (aka 
>simple to the lazy programer) parameters :)
>
>dbi-users (at) perl (dot) org
>[No worries I read this list too :)]
>
>would be able more sutied to answer DBI specific questions.  I'm assuming 
>you pointed this out b/c you didn't get the message you expected. Examples 
>?
>
Thanks for the response.  I only noticed it cuz I'm mucking around in there 
trying to get DBIx::HA on my machine to work with mp2 and act like 
Apache/DBI where you call it with DBI-> instead of DBIx::HA->



Re: Apache::DBI and mod_perl 2.0.1

Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
Vincent Moneymaker wrote:
> Philip, I think I've spotted another small Apache/DBI issue that I 
> thought I would run by you.
> 
> In the 'connect' function inside the DBI.pm module (as opposed to the 
> Apache/DBI.pm) there are somes lines about 12 lines down from the start 
> of the 'connect' function that reads as follows
> 
> $connect_meth ||= $DBI::connect_via;    # fallback to default
> $dsn ||= $ENV{DBI_DSN} || $ENV{DBI_DBNAME} || '' unless $old_driver;
> if ($DBI::dbi_debug) {
> local $^W = 0;
> pop @_ if $connect_meth ne 'connect';
> my @args = @_; $args[2] = '****'; # hide password
> DBI->trace_msg("    -> $class->$connect_meth(".join(", ",@args).")\n");
> }
> 
> This looks like the last value of the @arg array will be popped off 
> where the $connect_meth value has been set to Apache::DBI::connect via 
> the $DBI::connect_via variable.  It doesn't seem like a big deal but I 
> could see how it would drive someone crazy if they turned on 
> $DBI::dbi_debug and they weren't getting the messages back that they 
> expected.  Let me know if I am wrong on this and what I should do if I 
> am right.

You are correct in what it does; however, its not an issue as far as I 
can see.  The reason being is that the last arg of connect is the 
\%attrs hash ref.  Its replacing the password with *'s and then showing 
all SCALAR (aka simple to the lazy programer) parameters :)

dbi-users (at) perl (dot) org
[No worries I read this list too :)]

would be able more sutied to answer DBI specific questions.  I'm 
assuming you pointed this out b/c you didn't get the message you 
expected. Examples ?

HTH
END
------------------------------------------------------------
     What doesn't kill us can only make us stronger.
                 Nothing is impossible.
				
Philip M. Gollucci (pgollucci@p6m7g8.com) 301.254.5198
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Developer / Liquidity Services, Inc.
	http://www.liquidityservicesinc.com

Re: Apache::DBI and mod_perl 2.0.1

Posted by Vincent Moneymaker <vb...@hotmail.com>.
Philip, I think I've spotted another small Apache/DBI issue that I thought I 
would run by you.

In the 'connect' function inside the DBI.pm module (as opposed to the 
Apache/DBI.pm) there are somes lines about 12 lines down from the start of 
the 'connect' function that reads as follows

$connect_meth ||= $DBI::connect_via;	# fallback to default
$dsn ||= $ENV{DBI_DSN} || $ENV{DBI_DBNAME} || '' unless $old_driver;
if ($DBI::dbi_debug) {
local $^W = 0;
pop @_ if $connect_meth ne 'connect';
my @args = @_; $args[2] = '****'; # hide password
DBI->trace_msg("    -> $class->$connect_meth(".join(", ",@args).")\n");
}

This looks like the last value of the @arg array will be popped off where 
the $connect_meth value has been set to Apache::DBI::connect via the 
$DBI::connect_via variable.  It doesn't seem like a big deal but I could see 
how it would drive someone crazy if they turned on $DBI::dbi_debug and they 
weren't getting the messages back that they expected.  Let me know if I am 
wrong on this and what I should do if I am right.

Thanks Vince



Re: Apache::DBI and mod_perl 2.0.1

Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
Vincent Moneymaker wrote:

>I have a question which I am not sure whether it is loopy or not.
>
>In the Apache::DBI module module the variable '$Apache::ServerStarting' is
>used but I can't find any reference to it on the mod_perl site or elsewhere
>under /usr/local/lib/perl5 on my FreeBSD box.  The mod_perl site refers to
>an '$Apache::Server::Starting' variable but not the $Apache::ServerStarting
>variable.  Is this a mistake on the mod_perl site or in the Apache::DBI code
>or am I just getting confused.
>
>http://perl.apache.org/docs/2.0/user/porting/compat.html#C__Apache__Server__Starting__and_C__Apache__Server__ReStarting_
>
>Thanks, Vince Moneymaker
>  
>
Hi Vince,

 From Apache::DBI:

 > if ($Apache::ServerStarting and $Apache::ServerStarting == 1) {
 >        print STDERR "$prefix skipping connection during server 
startup, read the docu !!\n" if $Apache::DBI::DEBUG > 1;
 >        return $drh->connect(@args);
 >    }

This is something that was never updated for MP2 pre or post RC5 in 
Apache::DBI.  The mod_perl site is correct.
I'll patch this tonight or over the weekend as its a simple one (see below).
Thanks for the spot.

You're not finding any references to it in your code because it doesn't 
exist in MP2 as the documentation says expect in
compat.pm

Its defined as following in compat.pm:

 >($Apache::Server::Starting, $Apache::Server::ReStarting) =
 >    Apache2::ServerUtil::restart_count() == 1 ? (1, 0) : (0, 1);

-- 
END 
---------------------------------------------------------
    What doesn't kill us can only make us stronger.
               Nothing is impossible.
				
Philip M. Gollucci (pgollucci@p6m7g8.com) 301.254.5198
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Developer / Liquidity Services, Inc.
     http://www.liquidityservicesinc.com
        http://www.liquidation.com
        http://www.uksurplus.com
        http://www.govliquidation.com
        http://www.gowholesale.com