D
Dale
I'm creating a simple web-based image management tool and am looking
for a way of creating a tree structure to display folders and titles
of images contained in those folders. What I am trying to do is take a
very plain text string describing a path and parse that into a tree to
display in html.
My incoming data via DBI looks like this
/folder 1/image1.jpg
/folder 1/subfolder 1/image2.jpg
/folder 1/subfolder 1/subsub folder 1/image3.jpg
/folder 1/image4.jpg
/folder 2/image5.jpg
/folder 1/subfolder 2/image6.jpg
etc...
and I want to output sort of like
folder 1
-> subfolder 1
-> -> subsubfolder 1
-> -> -> image3.jpg
-> -> image2.jpg
-> subfolder 2
-> -> image6.jpg
-> image1.jpg
-> image4.jpg
folder 2
-> image5.jpg
though with lots of pretty icons and collapsing row structures (which
I won't bore you with since its jscript and not perl)
So my questions:
1. Is there a module available anywhere that already does this?
2. If not, I can work with one of the Tree:: modules and need ideas on
how to parse my paths into the required structure. (ie how to extract
the parent/child node relationships correctly)
3. And if there is another better way of accomplishing this whole task
I would love to hear about it.
* and for those list purists who are wondering where the perl is in
this question, my whole app is perl, so am looking for perl answers
using regexes, splits, and arrays or hashes, etc.
Many thanks in advance for any guidance
DRE
for a way of creating a tree structure to display folders and titles
of images contained in those folders. What I am trying to do is take a
very plain text string describing a path and parse that into a tree to
display in html.
My incoming data via DBI looks like this
/folder 1/image1.jpg
/folder 1/subfolder 1/image2.jpg
/folder 1/subfolder 1/subsub folder 1/image3.jpg
/folder 1/image4.jpg
/folder 2/image5.jpg
/folder 1/subfolder 2/image6.jpg
etc...
and I want to output sort of like
folder 1
-> subfolder 1
-> -> subsubfolder 1
-> -> -> image3.jpg
-> -> image2.jpg
-> subfolder 2
-> -> image6.jpg
-> image1.jpg
-> image4.jpg
folder 2
-> image5.jpg
though with lots of pretty icons and collapsing row structures (which
I won't bore you with since its jscript and not perl)
So my questions:
1. Is there a module available anywhere that already does this?
2. If not, I can work with one of the Tree:: modules and need ideas on
how to parse my paths into the required structure. (ie how to extract
the parent/child node relationships correctly)
3. And if there is another better way of accomplishing this whole task
I would love to hear about it.
* and for those list purists who are wondering where the perl is in
this question, my whole app is perl, so am looking for perl answers
using regexes, splits, and arrays or hashes, etc.
Many thanks in advance for any guidance
DRE