Re: Mixing of forward and back slashes in paths?

[email protected] Sun, 8 Mar 2015 19:29:58 +1100
Newsgroups perl.win32.vanilla
Message-ID <DEE701B105714A41A38A7B848683A54D@OwnerPC311012>
-----Original Message----- 
From: L. Walsh
Sent: Saturday, March 07, 2015 5:21 PM
To: [email protected]
Cc: Strawberry Perl
Subject: Re: Mixing of forward and back slashes in paths?


>> And if you do:
>> $^X = "C:\Strawberry\perl\bin\perl.exe";
> I don't do it -- perl does it.  Look at the listing for PERL5LIB at the 
> bottom of the report:

The setting of these things are determined by what's in the perl source 
distro and ought therefore be dealt with at the perl source level - so it 
needs to be achieved by patching the perl source (and perhaps some of the 
core modules).
I build perl from source myself - and see the same mixture of forward and 
backward slashes in paths.
I don't see it as being Strawberry's responsibility to deal with this (but I 
have no official position with the Strawberry project).

On Windows 7, I strike occasions where forward slashes are unworkable and 
need to be replaced by backslashes - so I'd be very annoyed if perl were 
ever to forbid the backslash in a path (or automatically convert it to a 
forward slash).

Here's an example of forward slashes being unworkable on my Windows 7 box. 
It relies on the existence of  ../doc.txt.

###########################
use warnings;
use strict;

my $f1 = '../doc.txt';
my $f2 = "../doc.txt";
my $f3 = '..\doc.txt';
my $f4 = "..\\doc.txt";

# will fail
warn "failed to copy $f1 to dac.txt"
  if system 'copy', $f1, 'dac.txt';

# will fail
warn "failed to copy $f2 to dec.txt"
  if system 'copy', $f2, 'dec.txt';

# will succeed
warn "failed to copy $f3 to dic.txt"
  if system 'copy', $f3, 'dic.txt';

# will succeed
warn "failed to copy $f4 to duc.txt"
  if system 'copy', $f4, 'duc.txt';

###########################

I don't know if the behaviour I see from this script is common.

Even if perl were to convert the backslash to forward slash for display 
purposes only, I would be very annoyed.
If I were to "say $f1;" in the above script, I would expect to see what's 
actually there  - namely "..\doc.txt".

But it's not me you need to convince about this - it's p5p  .... or kmx (who 
does have an official position with the Strawberry project).

I suspect it's now too late for either p5p or kmx to do anything about this 
for the upcoming 5.22 - maybe take it up in the next round of blead releases 
(5.23) ?

Cheers,
Rob