in reply to Cwd's abs_path not working with filetests?
dont use readdir because of cwd
readdir isn't for people its for computers, don't use readdir, use Path::Tiny
Let Path::Tiny be your interface to Cwd and readdir
#!/usr/bin/perl -- use strict; use warnings; use Path::Tiny qw/ path /; Main( @ARGV ); exit( 0 ); sub Main { my( $dir ) = @_; my $readdir = path( $dir )->realpath ->iterator( { qw/ recurse 0 / }); while( my $file = $readdir->() ){ Staterator( $file ); } } sub Staterator { local( $_ ) = @_; if( -z ){ ... } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Cwd's abs_path not working with filetests? (dont use readdir because of cwd
by Anonymous Monk on Nov 26, 2013 at 12:21 UTC |