Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (1)
As of 2018-08-18 14:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:









    Results (185 votes). Check out past polls.

    Notices?