cvs commit: p5ee/App-Repository/lib/App/Repository DBI.pm

[email protected] (Stephen Adkins)
Newsgroups perl.cvs.p5ee
Message-ID <[email protected]>
cvsuser     05/08/09 11:52:25

  Modified:    App-Repository/lib/App/Repository DBI.pm
  Log:
  config from options by default
  
  Revision  Changes    Path
  1.27      +16 -8     p5ee/App-Repository/lib/App/Repository/DBI.pm
  
  Index: DBI.pm
  ===================================================================
  RCS file: /cvs/public/p5ee/App-Repository/lib/App/Repository/DBI.pm,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- DBI.pm	25 Apr 2005 16:18:08 -0000	1.26
  +++ DBI.pm	9 Aug 2005 18:52:25 -0000	1.27
  @@ -310,12 +310,20 @@
           $self->{preconnected} = 1;
       }
       else {
  -        my ($var, $capsvar);
  -        foreach $var qw(dbdriver dbname dbuser dbpass dbioptions dbschema) {
  -            if (! defined $self->{$var}) {
  -                $capsvar = uc($var);
  -                if ($ENV{$capsvar}) {
  -                    $self->{$var} = $ENV{$capsvar};
  +        my $options = $self->{context}{options} || {};
  +
  +        my $config_from_options = 1;
  +        foreach my $var qw(dbdsn dbdriver dbhost dbport dbname dbuser dbpass dbschema dbioptions) {
  +            if ($self->{$var}) {
  +                $config_from_options = 0;
  +                last;
  +            }
  +        }
  +
  +        if ($config_from_options) {
  +            foreach my $var qw(dbdsn dbdriver dbhost dbport dbname dbuser dbpass dbschema dbioptions) {
  +                if (defined $options->{$var}) {
  +                    $self->{$var} = $options->{$var};
                   }
               }
           }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.