in reply to Is there a way to catch an error within a module?

For most file and directory handling Win32 APIs, there are two variants. Those with the A suffix (for ANSI character set) and those with a W suffix (for Wide character set). Eg. FindFirstFileA(...) & FindFirstFileW( ... ).

Perl is usually built to use the A suffix variants, and they have a built in limitation, on the length of paths, of 260 characters. The path in your error message is 262 characters.

Options:

  1. Try and build your own version of Perl having enable defined the macro USING_WIDE().

    I don't think anyone has tried this for a long time. I'm not sure that the implementation was very complete when it was working.

    A quick grep of the 5.10.0 sources suggests that all the support that did exist at 5.8.6 has been stripped out.

  2. Take the people that created those ridiculous paths out the back and shoot them.

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

Replies are listed 'Best First'.
Re^2: Is there a way to catch an error within a module?
by romandas (Pilgrim) on Mar 18, 2008 at 09:44 UTC

    Thanks for the information, though the options seem pretty bleak.

    Option 1, from your post, seems like a non-starter. Option 2, while BOFH-ly tempting, isn't likely either. The best I can do is rename them as I find them.. but given that this is a rather large filesystem, doing this onesy-twosy is going to be painful. At least I know what I'm in for..
      but given that this is a rather large filesystem, doing this onesy-twosy is going to be painful.

      Just type tree /a f: > tree.txt at a command line and go get a coffee. When you come back load the file into your editor and you'll quickly see what needs to be done.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
Re^2: Is there a way to catch an error within a module?
by Anonymous Monk on Mar 23, 2008 at 09:26 UTC
    MAX_PATH is the same for both

      Wrong! From the docs for FindFirstFile:

      In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to 32,767 widecharacters, call the Unicode version of the function and prepend "\\?\" to the path. For more information, see Naming a File.

      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.