| 153 | | my $rule = File::Find::Rule->new; |
|---|
| 154 | | $rule->file; |
|---|
| 155 | | $rule->name( qr/^\w[\w\.]*$/ ); |
|---|
| 156 | | my @files = $rule->in($path); |
|---|
| 157 | | |
|---|
| 158 | | for my $file (@files) { |
|---|
| 159 | | next if $file =~ /\W(?:\.svn|CVS)\b/; |
|---|
| 160 | | my $pkg = $self->extract_package($file) |
|---|
| 161 | | or die "Can't find package from $file"; |
|---|
| 162 | | |
|---|
| 163 | | (my $base = $file) =~ s!^$path/!!; |
|---|
| 164 | | $self->plugins_path->{$pkg} = $file; |
|---|
| | 153 | opendir my $dir, $path or do { |
|---|
| | 154 | $self->log(warn => "$path: $!"); |
|---|
| | 155 | next; |
|---|
| | 156 | }; |
|---|
| | 157 | while (my $ent = readdir $dir) { |
|---|
| | 158 | next if $ent =~ /^\./; |
|---|
| | 159 | $ent = File::Spec->catfile($path, $ent); |
|---|
| | 160 | if (-f $ent && $ent =~ /\.pm$/) { |
|---|
| | 161 | my $pkg = $self->extract_package($ent) |
|---|
| | 162 | or die "Can't find package from $ent"; |
|---|
| | 163 | (my $base = $ent) =~ s!^$path/!!; |
|---|
| | 164 | $self->plugins_path->{$pkg} = $ent; |
|---|
| | 165 | } elsif (-d $ent) { |
|---|
| | 166 | my $lib = File::Spec->catfile($ent, "lib"); |
|---|
| | 167 | if (-e $lib && -d _) { |
|---|
| | 168 | $self->log(debug => "Add $lib to INC path"); |
|---|
| | 169 | unshift @INC, $lib; |
|---|
| | 170 | } |
|---|
| | 171 | } |
|---|