operating system - Perl to set a directory to open, open it, then print the directory opened? -


trying troubleshoot port of perl code centos windows.

really know nothing perl, , code i'm porting around 700-1000 lines. 100% sure 1 of issues i'm seeing related how code being rendered result of being on os it's running on.

so, i'm looking way troubleshoot debugging how os's rendering filepath apart legacy code; can not post due "ip" reasons.

so, looking perl can set directory open within script (for example, c:\data\ or /home/data), script attempts load directory, prints if failed or succeeded, , prints string attempted load, regardless if code failed open directory or not.

open suggestions, that's issue, , solution i'm seeing.

questions, feedback, requests - comment, thanks!!

use io::dir;  $dir = io::dir->new($dir_path) or     die "could not open directory $dir_path: $!\n"; 

of course, $dir_path path directory on system want, either var or hard coded. more 'old school' way like:

opendir $dir, $dir_path or die "could not open directory $dir_path: $!\n"; 

that won't print of directory opened, program fail if doesn't open print precise error why, $! variable holds.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -