in reply to Re^7: Directory Tree Structure
in thread Directory Tree Structure

That got rid of the warning, but did not fix the problem. I think I will need to see the basics, meaning no HTML, so that HTML can be added back in as we go.

What I need on each line is the file with the full path.

C:/Documents and Settings/XXXX/My Documents/fantasy/<subdir> C:/Documents and Settings/XXXX/My Documents/fantasy/<subdir>/<filena +me_1>.ext C:/Documents and Settings/XXXX/My Documents/fantasy/<subdir>/<filena +me_2>.ext C:/Documents and Settings/XXXX/My Documents/fantasy/<subdir>/<filena +me_3>.ext C:/Documents and Settings/XXXX/My Documents/fantasy/<subdir_2> C:/Documents and Settings/XXXX/My Documents/fantasy/<subdir_2>/<file +name>.ext
-or-
/ftp/pub/www/fantasy/<subdir> /ftp/pub/www/fantasy/<subdir>/<filename_1>.ext /ftp/pub/www/fantasy/<subdir>/<filename_2>.ext /ftp/pub/www/fantasy/<subdir>/<filename_3>.ext /ftp/pub/www/fantasy/<subdir_2> /ftp/pub/www/fantasy/<subdir_2>/<filename>.ext

After we get the files listed properly, then the HTML can be added back in.

Have a nice day!
Lady Aleena

Replies are listed 'Best First'.
Re^9: Directory Tree Structure
by graff (Chancellor) on Nov 05, 2009 at 06:58 UTC
    When you say "got rid of the warning, but didn't fix the problem", do you mean that you are still seeing "empty" lines in the output? I'm not seeing that when I run the version below (sanitized to make it non-dependent on your specific paths).

    I added the minimal amount of stuff around the "print_tree()" function so that I could load it in a browser and even paste it into this validation tool that almut cited elsewhere in this thread; I see no blank lines in the raw or rendered html, and it passed validation (with just a couple warnings about unrelated stuff).

    If you're still seeing a problem with your directory tree, maybe there's something strange in the file names that you are dealing with (e.g. html-reserved characters in a file name, or something like that). In that case, it'll be worthwhile to get a plain-text dump of the tree to see if that's the problem -- or better yet, add HTML::Entities to your program, and use its "encode_entities" method on all the file names.

    In fact, I've gone ahead and done that in the version below, just because it's a good idea anyway.

    (updated to fix validation web site link)
      I think I have figured out why the above works wonky for me. The root directory on my home computer has my name in it. The period after my middle initial is messing up sub load_tree. So, can we change the dots to something else?
      Have a nice day!
      Lady Aleena
        I'm not really convinced about your diagnosis. If you have a directory name like "Firstname I. Lastname", that whole string should be showing up (with spaces and period character) as one of the the hash keys when you split the path on slash characters. There might be something else screwy in your directory structure or file names. (Have you ever seen a line-feed and/or carriage-return character used as (part of) a file name? I have. It does nasty things.)

        You can go ahead and try something besides "." for the parts in the code that use "." (or "./") as a hash key. Or, you could try renaming the directory that has your middle initial in its name, to see if that makes the problem go away. Or you could create a symbolic link ("shortcut" in windows parlance) to that directory so that you can use some other string as its path name.

        In any case, I don't think there's anything more I can do here. It works for me, and I can't replicate the problem you're having. (Does it work for you on other paths, at least?)