in reply to Contacting the author of a module?

Win32::LongPath seems to be exactly what I need to deal with the files...

What is it about this module that appeals to you ?

I generally find it very annoying when someone responds to a simple question by asking the question that I've just asked - so I apologize for asking it.
It's just that, in one of my scripts, I have found a need to call on (the similarly named) Win32::GetLongPathName function - and I wonder if that function might also serve your needs.

Essentially, I just use Win32::GetLongPathName() for case-sensitive checking of filenames on Windows.

Cheers,
Rob

Replies are listed 'Best First'.
Re^2: Contacting the author of a module?
by ikegami (Patriarch) on Jan 06, 2023 at 19:00 UTC

    See earlier question. The builtins of Windows builds of Perl can't deal with file name with characters outside of the system's Active Code Page (e.g. 1252 on my system). But this module can.

Re^2: Contacting the author of a module?
by BernieC (Pilgrim) on Jan 06, 2023 at 13:27 UTC
    I have a bunch of files with filenames that are all filled with Unicode stuff. I've always been a bit confused by how Unicode and ISO-Latin co-exist in Perl and I've really never had any need for Unicode so I've not worried about it much. The *only* thing I want to do with these files is fix their names by eliminating the Unicode stuff. I expect that the more unicode competent Perl folk will be horrified, but this is the routine I use to un-Unicode the file names:
    #Remove all the unicode characters sub sanitize { my $unicode = $_[0] ; my $ascii ; for my $char (split(//, $unicode)) { $ascii .= $char if ord($char) < 256 } return $ascii; }

      Your sub is equivalent to

      sub sanitize { $_[0] =~ s/[^\x00-\xFF]//gr }

      But it's wrong if you're trying to generate file names Perl can handle. cp1252 can't encode U+0080 to U+009F except U+0081, U+008D, U+008F, U+0090 and U+009D. Fixed:

      sub sanitize { decode( "cp1252", encode( "cp1252", sub{ "" } ) ) }