Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: Should I Make A Module?

by Aristotle (Chancellor)
on Mar 16, 2003 at 02:02 UTC ( #243398=note: print w/replies, xml ) Need Help??

in reply to Should I Make A Module?

I'm leaning towards it not being worth doing. Something like that is trivial to do with File::Find. Specify the desired data format to produce more closely and someone will likely scribble some code to spit that out in all of a half dozen lines.

I'm not sure it makes a lot of sense, either.. both the directory structure and the resultant data structure are trees, so you need to write tree-traversal code to do anything with either. Why do whatever it is you need to do while traversing a data structure created by traversing the directory structure, and not do the work right as you're traversing the directory structure, with no intermediate data structure involved?

On the other hand, if it's the interface of File::Find you don't like - have you looked for an alternative? Tie::Dir lets you treat directories as hashes on the fly, f.ex; it's trivial to write a few lines of wrapper code around it to traverse directory trees. Or to subclass it to return tied hashes when you look at an entry that represents a directory. Or..

Makeshifts last the longest.

Replies are listed 'Best First'.
Re: Re: Should I Make A Module?
by coolmichael (Deacon) on Mar 16, 2003 at 04:25 UTC
    Tie::Dir doesn't seem to return a recursive data structure, which is what I am looking for. I've run into a few odd circumstances where changing the contents of a directory (creating new files, for example) did strange things to File::Find.

    -- - all things inbetween.

      As I said, it should be rather simple to subclass it so that it does.

      Makeshifts last the longest.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://243398]
[stevieb]: I'm checking some other versions. This is a little frightening
[pryrt]: Sorry, my bad: it was't done downloading when I did the sha1sum... now I match your 309ad... value
[stevieb]: I'll see how to get in touch with someone and advise that there's an issue. Thanks for helping me confiirm pryrt!
[pryrt]: also mismatches; but matches their sha1

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (12)
As of 2017-03-29 21:02 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (353 votes). Check out past polls.