Changeset 187


Ignore:
Timestamp:
12/25/10 20:49:58 (13 years ago)
Author:
nanardon
Message:
  • allow to read config from a file
File:
1 edited

Legend:

Unmodified
Added
Removed
  • client/trunk/bin/sophie

    r171 r187  
    66use Getopt::Long; 
    77use Pod::Usage; 
     8use Config::General; 
    89 
    910GetOptions( 
     11    'c=s' => \my $configfile, 
    1012    'u=s' => \my $url, 
    1113    'l=s' => \my $login, 
     
    2022    m/([^=]+)\s*=\s*(.*)/ or next; 
    2123    $options{$1} = $2; 
     24} 
     25 
     26$configfile ||= "$ENV{HOME}/.sophie.conf"; 
     27 
     28if (my $conf = Config::General->new($configfile)) { 
     29    my %config = $conf->getall; 
     30    $url         ||= $config{url}; 
     31    $login       ||= $config{login}; 
     32    $pass        ||= $config{pass}; 
     33    $daemon      ||= $config{daemon}; 
    2234} 
    2335 
Note: See TracChangeset for help on using the changeset viewer.