----- Original Message -----
From: "$Bill Luebkert" <[EMAIL PROTECTED]>
To: "Sisyphus" <[EMAIL PROTECTED]>
Cc: "perl-win32-users" <[email protected]>
Sent: Wednesday, September 07, 2005 11:55 AM
Subject: Re: system("rmdir...") not working like it once did
> Sisyphus wrote:
>
> > Indeed I do .... problems like this always arise from the "other" change
> > that one has made (ie the change that one has forgotten about :-)
> >
> > In my case that other change was to add MSYS\bin to the current shell's
path
> > a few days ago. Apparently I'm still running that same (cmd.exe) shell.
> >
> > The MSYS shell's version of rmdir expects forward slashes as path
> > separators, and knows nothing about the S and Q switches. So it's not
> > surprising that it thinks that /S and /Q are directories.
> >
> > I'm still puzzled by that backslash-escape issue, however:
> >
> > D:\pscrpt>type try.pl
> >
> > use warnings;
> > $z1 = "hello\tworld";
>
> The \t above becomes a tab (0x09) in $z1.
>
> > print $z1, "\n";
> > $z2 = "hello\\tworld";
>
> The \\ above becomes a \ in $z2.
>
> > print $z2, "\n";
> > system("rmdir $z2");
> >
> > D:\pscrpt>perl try.pl
> > hello world
>
> See the tab in the above line ?
>
> > hello\tworld
>
> And the single \ above.
>
> > rmdir: `hello\\tworld': No such file or directory
>
> Here we have a strange conversion of the file name.
> Firstly, we have an acute instead of a single quote (much like
> in the Perl man pages - which I never understood). And second,
> the \ has been converted to \\. I assume this is what your second
> version of rmdir puts out for some reason.
>
> cmd.exe would output "The system cannot find the path specified.".
>
> And called from the Perl script, I get:
> rmdir: hello\tworld: No such file or directory
> See below.
>
> cmd.exe output :
> hello world
> hello\tworld
> rmdir: hello\tworld: No such file or directory
>
> tcsh.exe output (guess why I always use / instead of \) :
> hello world
> hello\tworld
> <rmdir-path>\rmdir: hellotworld: No such file or directory
>
> > D:\pscrpt>
> >
> > (That's still using the MSYS/bin/rmdir.exe.)
> >
> > I *think* I understand. When print() receives the argument $z2, it
receives
> > "hello\\tworld" - and it's the print() function that decides that the
first
> > backslash escapes the second.
>
> Not true - the \\ was already converted to \ in $z2.
>
> > When rmdir receives the argument $z2, it
also
> > receives "hello\\tworld", but it doesn't recognize the backslash as an
> > escape and treats it literally. Is that right ?
>
> Not true, the \\ was already converted in $z2 to \.
>
> > Up until now, I've always thought that when print() receives the
argument
> > $z2, it actually receives "hello\tworld" as its argument and prints
> > (literally) that. I guess that assumption is (and always was) wrong.
>
> That assumption was correct.
>
> > If
that
> > assumption were correct, then we'd have to accept that the $z2 that
print()
> > receives is different to the $z2 that rmdir receives - and I find it
> > difficult to reconcile such a difference.
>
> That logic doesn't follow. It's your screwed up rmdir that's confusing
you. ;)
>
Yep - that covers everything very clearly. I was indeed confused by what the
"screwed up rmdir" was doing. It never occurred to me that it might be
doubling the backslashes.
Cheers,
Rob
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs