Changeset 23be736 for perlwrap.pm


Ignore:
Timestamp:
Dec 24, 2006, 11:24:47 AM (14 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
f62550d
Parents:
17eed9c
git-author:
Nelson Elhage <nelhage@mit.edu> (12/24/06 11:06:47)
git-committer:
Nelson Elhage <nelhage@mit.edu> (12/24/06 11:24:47)
Message:
Better error reporting when loading modules
File:
1 edited

Legend:

Unmodified
Added
Removed
  • perlwrap.pm

    r71e1e80 r23be736  
    1111BEGIN {
    1212# bootstrap in C bindings and glue
    13 bootstrap owl 1.2;
     13    bootstrap owl 1.2;
    1414};
    1515
     
    379379    $reload = 0;
    380380    @onMainLoop = ();
    381   @onStartSubs = ();
     381    @onStartSubs = ();
    382382   
    383383    # Do reload
     
    385385    if (do "$ENV{HOME}/.owlconf" && owl::reload_hook(@_))
    386386    {
    387         return "owlconf reloaded";
     387        return "owlconf reloaded";
    388388    }
    389389    else
     
    391391        return "$ENV{HOME}/.owlconf load attempted, but error encountered:\n$@";
    392392    }
    393 package owl;
     393    package owl;
    394394}
    395395
     
    406406sub loadModules () {
    407407    my @modules;
     408    my $rv;
    408409    foreach my $dir ( owl::get_data_dir() . "/owl/modules",
    409         $ENV{HOME} . "/.owl/modules" )
     410                      $ENV{HOME} . "/.owl/modules" )
    410411    {
    411412        opendir( MODULES, $dir );
     
    415416
    416417        foreach my $mod (@modules) {
    417                 unless (do "$dir/$mod") {
    418                         if($!) {
    419                                 owl::error("Error loading $dir/$mod: $!");
    420                         } elsif($@) {
    421                                 owl::error("Error loading $dir/$mod: $@");
    422                         }
    423                 }
     418            unless ($rv = do "$dir/$mod") {
     419                owl::error("Couldn't load $dir/$mod:\n $@") if $@;
     420                owl::error("Couldn't run $dir/$mod:\n $!") unless defined $rv;
     421            }
    424422        }
    425423        closedir(MODULES);
    426424    }
    427 
    428425}
    429426
Note: See TracChangeset for help on using the changeset viewer.