IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4874


Ignore:
Timestamp:
Aug 24, 2005, 3:44:32 PM (21 years ago)
Author:
jhoblitt
Message:

rename Nebulous::Server->setup() -> Nebulous::Server->init()
add Nebulous::Server::Config singleton
pass all Nebulous::Server->init() params to Nebulous::Server::Config->init()

Location:
trunk
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous-Server/lib/Nebulous/Server.pm

    r4440 r4874  
    11# Copyright (c) 2004  Joshua Hoblitt
    22#
    3 # $Id: Server.pm,v 1.9 2005-06-30 02:35:06 jhoblitt Exp $
     3# $Id: Server.pm,v 1.10 2005-08-25 01:44:32 jhoblitt Exp $
    44
    55package Nebulous::Server;
     
    1212use DBI;
    1313use Nebulous::Util qw( :standard );
     14use Nebulous::Server::Config;
    1415use Nebulous::Server::Log;
    1516use Nebulous::Server::SQL;
     
    2526my $db;
    2627
    27 sub setup {
    28     my $self = shift;
    29 
    30     my ( $dsn, $user, $passwd ) = validate_pos( @_,
    31         {
    32             type        => SCALAR,
    33         },
    34         {
    35             type        => SCALAR,
    36         },
    37         {
    38             type        => SCALAR,
    39         },
    40     );
     28sub init {
     29    my $self = shift;
     30
     31    # let Nebulous::Server::Config validate our params
     32    my $config = Nebulous::Server::Config->init( @_ );
     33
     34    # log4perl is not avaliable until we call init()
     35    Nebulous::Server::Log->init;
    4136
    4237    $log = Log::Log4perl::get_logger( "Nebulous::Server" );
     
    4742    eval {
    4843        $db = DBI->connect(
    49             $dsn,
    50             $user,
    51             $passwd,
     44            $config->dsn,
     45            $config->dbuser,
     46            $config->dbpasswd,
    5247            {
    5348                RaiseError => 1,
  • trunk/Nebulous/lib/Nebulous/Server.pm

    r4440 r4874  
    11# Copyright (c) 2004  Joshua Hoblitt
    22#
    3 # $Id: Server.pm,v 1.9 2005-06-30 02:35:06 jhoblitt Exp $
     3# $Id: Server.pm,v 1.10 2005-08-25 01:44:32 jhoblitt Exp $
    44
    55package Nebulous::Server;
     
    1212use DBI;
    1313use Nebulous::Util qw( :standard );
     14use Nebulous::Server::Config;
    1415use Nebulous::Server::Log;
    1516use Nebulous::Server::SQL;
     
    2526my $db;
    2627
    27 sub setup {
    28     my $self = shift;
    29 
    30     my ( $dsn, $user, $passwd ) = validate_pos( @_,
    31         {
    32             type        => SCALAR,
    33         },
    34         {
    35             type        => SCALAR,
    36         },
    37         {
    38             type        => SCALAR,
    39         },
    40     );
     28sub init {
     29    my $self = shift;
     30
     31    # let Nebulous::Server::Config validate our params
     32    my $config = Nebulous::Server::Config->init( @_ );
     33
     34    # log4perl is not avaliable until we call init()
     35    Nebulous::Server::Log->init;
    4136
    4237    $log = Log::Log4perl::get_logger( "Nebulous::Server" );
     
    4742    eval {
    4843        $db = DBI->connect(
    49             $dsn,
    50             $user,
    51             $passwd,
     44            $config->dsn,
     45            $config->dbuser,
     46            $config->dbpasswd,
    5247            {
    5348                RaiseError => 1,
Note: See TracChangeset for help on using the changeset viewer.