use File::Spec qw(); use Path::Class qw(dir file); use File::HomeDir qw(); sub find_config { my $path = dir('.')->absolute; while ($path) { my $file = file($path, 'my.conf'); return $file if -e $file; last if $path eq File::Spec->rootdir; $path = $path->parent; } my $file = file(File::HomeDir->my_home, 'my.conf'); return -e $file ? $file : ''; }
In reply to Re: Find config file by traverse directory
by Anonymous Monk
in thread Find config file by traverse directory
by voj
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |