M: Fixed example code.

This commit is contained in:
Jens Luedicke
2013-03-10 18:07:01 +01:00
parent 538260b627
commit 0d51c0eae0

View File

@@ -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";