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

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.


Comment on Re: Should I Make A Module?
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.

    --
    negativespace.net - all things inbetween.

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

      Makeshifts last the longest.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2014-07-13 08:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (248 votes), past polls