Re: The perfect solution / Re: Apache not behaving nicely with cdbi (#2)

[prev] [thread] [next] [Date index for 2005/02/15]

From: Perrin Harkins
Subject: Re: The perfect solution / Re: Apache not behaving nicely with cdbi (#2)
Date: 20:15 on 15 Feb 2005
On Tue, 2005-02-15 at 12:33 -0500, Andy Grundman wrote:
> Once, I thought I found the source of my closure, in this code:
> 
> sub getDbh {
>          my $self = shift;
>          my ($dsn, $dbuser, $dbpass) = @_;
> 
>          my $dbh = "";
>          if ($ENV{MOD_PERL} && !$Apache::ServerStarting) {
>                  $dbh = Apache->request->pnotes('dbh');
>          }
>          if (!$dbh) {
>                  my %options = $self->_default_attributes;
>                  $options{PrintError} = 1;
> this line ---->  my $dbh = DBI->connect_cached($dsn, $dbuser, $dbpass, 
> \%options) or die $@;
>                  if ($ENV{MOD_PERL} && !$Apache::ServerStarting) {
>                          Apache->request->pnotes('dbh', $dbh);
>                  }
>          }
>          return $dbh;
> }
> 
> I was creating a local $dbh and then storing it in the pnotes, so I 
> thought maybe that was my closure.

No, storing things in pnotes doesn't create a closure.  If you defined
"my $dbh" before entering this subroutine and removed the "my" keyword
here, that would create a closure.

- Perrin

Apache not behaving nicely with cdbi (#2)
karjala_lists 07:27 on 15 Feb 2005

Re: Apache not behaving nicely with cdbi (#2)
karjala_lists 07:37 on 15 Feb 2005

Re: Apache not behaving nicely with cdbi (#2)
Perrin Harkins 14:38 on 15 Feb 2005

Re: Apache not behaving nicely with cdbi (#2)
karjala_lists 16:35 on 15 Feb 2005

Re: The perfect solution / Re: Apache not behaving nicely with cdbi (#2)
Perrin Harkins 20:15 on 15 Feb 2005

Re: Apache not behaving nicely with cdbi (#2)
Perrin Harkins 18:32 on 15 Feb 2005

Re: Apache not behaving nicely with cdbi (#2)
karjala_lists 07:14 on 16 Feb 2005

Re: Apache not behaving nicely with cdbi (#2)
Perrin Harkins 13:36 on 16 Feb 2005

Generated at 11:20 on 20 Feb 2005 by mariachi v0.52