Changeset 179
- Timestamp:
- 09/03/04 09:09:40 (4 years ago)
- Files:
-
- manage/trunk/CLI.pm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
manage/trunk/CLI.pm
r177 r179 52 52 53 53 if (opendir(D, $args{plugins})) { 54 my @files; 55 54 56 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); 64 65 } 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; 68 67 } 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; 69 73 } 70 74 }
