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

RE: Going it alone without File::Find

by merlyn (Sage)
on Sep 18, 2000 at 23:41 UTC ( [id://33020]=note: print w/replies, xml ) Need Help??


in reply to Going it alone without File::Find

Beware - this code will erroneously chase symlinks, possibly causing infinite looping.

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
RE: RE: Going it alone without File::Find
by ZZamboni (Curate) on Sep 18, 2000 at 23:51 UTC
    The way to fix that would be to change the test to
    if (-d $file && ! -l $file)
    Also possibly change the syntax check to:
    die "Syntax: $0 <dir>" unless @ARGV == 1 && (-d $ARGV[0] && ! -l $ARGV[0]);

    --ZZamboni

RE: RE: Going it alone without File::Find
by bastard (Hermit) on Sep 19, 2000 at 17:34 UTC
    If you're going to say the code is bad, at least suggest a fix. Fortunately ZZamboni already has.
      My "fix" is the normal fix. Use File::Find, or suggest patches to it if it doesn't work the way you want. That way I don't have to review every line of your code in code-review to find out if you've broken it on some platforms, or introduced a security hole.

      The cost of revinventing the wheel is not just in development, but in every phase afterward: testing, documenting, production, and maintenance.

      -- Randal L. Schwartz, Perl hacker

        Thanks. Althought "the normal fix" may be apparent to you, it may not be as apparent to the many other people who read the site.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2024-04-23 10:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found