Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

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]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2018-02-17 23:23 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (250 votes). Check out past polls.