Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Dir Structure Print out

by rob_au (Abbot)
on Nov 14, 2001 at 18:51 UTC ( [id://125312]=note: print w/replies, xml ) Need Help??


in reply to Dir Structure Print out

In addition to the other comments above, I would like to make the following two small additional comments:

  1. There is a great potential for an endless recursive loop to be established if your program processes a symbolic link to a directory higher in the directory tree - This is a common trap that File::Find-like subroutines get caught by. To correct this, simply add a negative test for symbolic link with your -d test. ie.

    if (-d $dir && !-l _) { ... };
  2. And less importantly, the sort by_lc readdir(DIR) block in the op_dir subroutine could more easily be written as thus:

    foreach (sort { lc($a) cmp lc($b) } readdir(DIR)) { push (@dir, "$dir\/$_") if (m/$non_include/); };

 

Ooohhh, Rob no beer function well without!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://125312]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2024-04-25 06:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found