/[A3C]/lib/Strix.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /lib/Strix.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 169 by dpavlin, Mon Jun 16 12:44:57 2008 UTC revision 171 by dpavlin, Mon Jun 16 13:16:57 2008 UTC
# Line 30  Strix Line 30  Strix
30    
31  =cut  =cut
32    
33    our $site_dbh;
34    
35  sub dbh {  sub dbh {
36          my $self = shift;          my $self = shift;
37    
38          my $site = shift || $self->site || confess "no site";          my $site = shift || $self->site || confess "no site";
39    
40            return $site_dbh->{$site} if $site_dbh->{$site};
41    
42          my $config = Jifty->config->app('strix') or die "need strix config";          my $config = Jifty->config->app('strix') or die "need strix config";
43          my $database = $config->{database} or die "no strix.database in config";          my $database = $config->{database} or die "no strix.database in config";
44    
# Line 49  sub dbh { Line 53  sub dbh {
53    
54          my $dbh = DBI->connect( $dsn, $database->{user}, $database->{passwd} ) or die $DBI::errstr;          my $dbh = DBI->connect( $dsn, $database->{user}, $database->{passwd} ) or die $DBI::errstr;
55    
56            $site_dbh->{$site} = $dbh;
57    
58            warn "## site_dbh = ",dump( $site_dbh );
59    
60          return $dbh;          return $dbh;
61  }  }
62    

Legend:
Removed from v.169  
changed lines
  Added in v.171

  ViewVC Help
Powered by ViewVC 1.1.26