Changeset 163

Show
Ignore:
Timestamp:
07/19/10 14:41:27 (7 weeks ago)
Author:
oz
Message:

Finish cleanup

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/lib/whatbot.pm

    r162 r163  
    2828    has 'last_message'      => ( is => 'rw', isa => 'whatbot::Message' ); 
    2929 
    30     method config ( Str $basedir, Str $config_path ) { 
     30    method config ( Str $basedir, Str $config_path? ) { 
    3131     
    3232        # Find configuration file 
    3333        unless ($config_path and -e $config_path) { 
    3434                my @try_config = ( 
    35                         $basedir . '/conf/whatbot.conf', 
     35                        '~/.whatbot/whatbot.conf', 
     36                        '/usr/local/etc/whatbot/whatbot.conf', 
     37                        '/usr/local/etc/whatbot.conf', 
    3638                        '/etc/whatbot/whatbot.conf', 
    3739                        '/etc/whatbot.conf', 
    38                         '/usr/local/etc/whatbot/whatbot.conf', 
    39                         '/usr/local/etc/whatbot.conf' 
     40                        $basedir . '/conf/whatbot.conf', 
    4041                ); 
    4142                foreach (@try_config) { 
    42                         $config_path = $_ if (-e $_); 
     43                        if (-e $_) { 
     44                                $config_path = $_; 
     45                                last; 
     46                        } 
    4347                } 
    4448                unless ($config_path and -e $config_path) { 
     
    135139        $store->connect(); 
    136140        $self->report_error('Configured store failed to load properly') 
    137             unless ( defined $store and defined $store->handle ); 
     141            unless ( $store and defined $store->handle ); 
    138142        $base_component->store($store); 
    139143         
     
    149153        foreach my $io_module ( @{$self->initial_config->io} ) { 
    150154                $log->error('No interface designated for one or more IO modules') 
    151                     unless ( defined $io_module->{'interface'} ); 
     155                    unless ( $io_module->{'interface'} ); 
    152156                 
    153157                my $io_class = 'whatbot::IO::' . $io_module->{'interface'}; 
     
    159163                ); 
    160164                $self->report_error('IO interface "' . $io_module->{'interface'} . '" failed to load properly')  
    161                 unless ( defined $io_object ); 
     165                unless ($io_object); 
    162166 
    163167                $ios{ $io_object->name } = $io_object; 
    164                 push(@io, $io_object); 
     168                push( @io, $io_object ); 
    165169        } 
    166170        $base_component->ios(\%ios); 
     
    178182                $log->write('Sending connect to ' . ref($io_object)); 
    179183                $io_object->controller($controller); 
    180                 $io_object->connect; 
     184                $io_object->connect(); 
    181185        } 
    182186