Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: Dir Structure Print out

by rob_au (Abbot)
on Nov 14, 2001 at 18:51 UTC ( #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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://125312]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (1)
As of 2018-05-26 00:43 GMT
Find Nodes?
    Voting Booth?