Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I wrote a simple that prints only files recursively. But I have a problem.
whenever It meets named pipe, it gets blocked at all!
I thought it would be ok if I add just -p test,but that's too late because program is blocked when opening the named pipe!
#!/usr/bin/perl -w use latest; use File::Spec; my $test=$ARGV[0]; my $ds='/'; sub bfs { my $path=$_[0]; push(my @queue,$path); my ($current,@output); while(@queue) { $path=shift(@queue); if($path=~/${ds}\.{1,2}$/){next} opendir($current,$path) or open($current,$path) or next; if(-d $current) { push @queue,map {File::Spec->catfile($path,$_)} readdir $c +urrent; closedir $current } elsif(-f $current) { say $path; close $current; push @output,$path; } } @output; } bfs($test);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Whenever perl meets namedpipe it gets blocked
by kennethk (Abbot) on Jan 23, 2015 at 19:00 UTC | |
|
Re: Whenever perl meets namedpipe it gets blocked
by Anonymous Monk on Jan 23, 2015 at 19:47 UTC | |
|
Re: Whenever perl meets namedpipe it gets blocked
by pme (Monsignor) on Jan 24, 2015 at 16:19 UTC |