- Timestamp:
- Mar 23, 2007, 3:09:45 PM (18 years ago)
- Branches:
- master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 9729dba
- Parents:
- b547aa4
- git-author:
- Nelson Elhage <nelhage@mit.edu> (03/23/07 15:09:38)
- git-committer:
- Nelson Elhage <nelhage@mit.edu> (03/23/07 15:09:45)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/lib/BarnOwl/ModuleLoader.pm
r2622450 r836e6263 15 15 $ENV{HOME} . "/.owl/modules" ) { 16 16 opendir(my $dh, $dir) or next; 17 while(defined(my $f = readdir($dh))) { 18 next if $f =~ /^\./; 19 if(-f "$dir/$f" && $f =~ /^(.+)\.par$/) { 20 $modules{$1} = 1; 21 } elsif(-d "$dir/$f" && -d "$dir/$f/lib") { 22 push @INC, "$dir/$f/lib" unless grep m{^$dir/$f/lib$}, @INC; 23 $modules{$f} = 1; 24 } 25 } 17 26 @modules = grep /\.par$/, readdir($dh); 18 27 closedir($dh); … … 30 39 } 31 40 41 sub reload { 42 my $class = shift; 43 for my $m (keys %INC) { 44 delete $INC{$m} if $m =~ m{^BarnOwl/}; 45 } 46 # Restore core modules from perlwrap.pm 47 $INC{$_} = 1 for (qw(BarnOwl.pm BarnOwl/Hooks.pm 48 BarnOwl/Message.pm BarnOwl/Style.pm)); 49 50 $BarnOwl::Hooks::startup->clear; 51 local $SIG{__WARN__} = \&squelch_redefine; 52 $class->load_all; 53 $BarnOwl::Hooks::startup->run(1); 54 BarnOwl::startup() if *BarnOwl::startup{CODE}; 55 } 56 57 sub squelch_redefine { 58 my $warning = shift; 59 warn $warning unless $warning =~ /redefined/; 60 } 61 32 62 1;
Note: See TracChangeset
for help on using the changeset viewer.