There's more than one way to do things | |
PerlMonks |
Re: Re: How to map a directory tree to a perl hash treeby Rudif (Hermit) |
on Mar 12, 2001 at 02:15 UTC ( [id://63672]=note: print w/replies, xml ) | Need Help?? |
May be it would be suitable to use tied hash(see e.g. Tie::Dir)? Tie::Dir handles files in one directory. It should be posible to write a Tie::DirTree along similar lines. At times I used Tie modules (Win32::OLE, Tie::Registry), but at this stage I don't have a feel for the advantages of a Tie module relative to a plain module. I suppose a Tie module adds syntactic convenience. Can you or any other Monk elaborate on this? Do you really need to load all the directory tree into the memory before scanning? It depends on what I want to do. A simple job (e.g. count the number of .html files and compute their total size) can be done simply in the find's wanted subroutine. For more elaborate jobs it might be better to first extract the relevant directory and file information into a Perl structure and then work on that structure, for example:
In Section
Seekers of Perl Wisdom
|
|