Changeset 179

Show
Ignore:
Timestamp:
09/03/04 09:09:40 (4 years ago)
Author:
svn
Message:

Ordered loading of modules now occurs.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • manage/trunk/CLI.pm

    r177 r179  
    5252 
    5353                if (opendir(D, $args{plugins})) { 
     54                my @files; 
     55 
    5456                        while (my $file = readdir(D)) { 
    55                                 if ($file =~ /^[^.].*\.pm$/) { 
    56                                         $file =~ s/\.pm$//; 
    57                                         if (my $plugin = do("$args{plugins}/$file.pm")) { 
    58                                                 if (ref($plugin) eq 'HASH') { 
    59                                                         $self->{plugins}->{$file} = new CLI::Plugin(grammar => $plugin); 
    60                                                 } else { 
    61                                                         $self->{plugins}->{$file} = $plugin; 
    62                                                 } 
    63                                                 $self->merge($self->{plugins}->{$file}->{grammar}); 
     57                                push(@files, $file) if $file =~ /^[^.].*\.pm$/; 
     58                        } 
     59 
     60                        for my $file (sort(@files)) { 
     61                                $file =~ s/\.pm$//; 
     62                                if (my $plugin = do("$args{plugins}/$file.pm")) { 
     63                                        if (ref($plugin) eq 'HASH') { 
     64                                                $self->{plugins}->{$file} = new CLI::Plugin(grammar => $plugin); 
    6465                                        } else { 
    65                                                 $| = 1; 
    66                                                 print(STDERR "\e[1m\e[31mCLI plugin '$file' error:\e[22m\n" . $format->format($@) . "\e[0m"); 
    67                                                 $| = 0; 
     66                                                $self->{plugins}->{$file} = $plugin; 
    6867                                        } 
     68                                        $self->merge($self->{plugins}->{$file}->{grammar}); 
     69                                } else { 
     70                                        $| = 1; 
     71                                        print(STDERR "\e[1m\e[31mCLI plugin '$file' error:\e[22m\n" . $format->format($@) . "\e[0m"); 
     72                                        $| = 0; 
    6973                                } 
    7074                        }