M: Fixed example code.
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use File::Basename;
|
||||
use File::DirWalk;
|
||||
|
||||
my $dw = new File::DirWalk();
|
||||
@@ -11,21 +10,20 @@ my $dw = new File::DirWalk();
|
||||
$dw->onDirEnter(sub {
|
||||
my ($path) = @_;
|
||||
|
||||
print "$path\n";
|
||||
|
||||
if (basename($path) =~ /sbin|lib|share|local|include|libexec|X11/) {
|
||||
if ($dw->currentBasename() =~ /sbin|lib|share|local|include|libexec|X11/) {
|
||||
return PRUNE;
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
});
|
||||
|
||||
my $found = "";
|
||||
|
||||
$dw->onFile(sub {
|
||||
my ($path) = @_;
|
||||
|
||||
print "$path\n";
|
||||
|
||||
if (basename($path) eq "perl") {
|
||||
if ($dw->currentBasename() eq "perl") {
|
||||
$found = $path;
|
||||
return ABORTED;
|
||||
}
|
||||
|
||||
@@ -33,3 +31,5 @@ $dw->onFile(sub {
|
||||
});
|
||||
|
||||
$dw->walk("/usr");
|
||||
|
||||
print "perl is in $found\n";
|
||||
Reference in New Issue
Block a user