Changeset 29 for trunk


Ignore:
Timestamp:
11/05/05 17:30:01 (19 years ago)
Author:
thauvin
Message:
  • allow to handle object if no config file is specified
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/soft/ObsData/ObsData.pm

    • Property cvs2svn:cvs-rev changed from 1.5 to 1.6
    r25 r29  
    2929sub new { 
    3030    my ($class, $configfile) = @_; 
    31     my $obsdata = { 
    32         config => new Config::IniFiles( 
     31    my $obsdata = {}; 
     32     
     33    if ($configfile) { 
     34        (-f $configfile && -r _) or return undef; 
     35        $obsdata->{config} = new Config::IniFiles( 
    3336            -file => $configfile, 
    3437            -default => 'global', 
    3538            -allowcontinue => 1 
    36         ), 
    37     }; 
    38      
    39     (-f $configfile && -r _) && $obsdata->{config} or return undef; 
     39        ) or return undef; 
     40    } 
     41 
    4042    bless($obsdata, $class); 
    4143} 
Note: See TracChangeset for help on using the changeset viewer.