Slash ou anti slash en sortie de cwd::realpath
Bonjour,
Avec Cwd::realpath, j'ai 2 résultats différents selon l'entrée : des slash ou des anti-slashs.
(windows xp, perl 5.8.8)
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| #! /user/bin/perl
use File::Basename;
use Cwd;
use Cwd 'realpath';
my ($script, $path) = fileparse ("$0");
print "FILEPARSE SCRIPT : $script\n";
print "FILEPARSE PATH : $path\n";
my $realpath_script = realpath ("$script");
print "REALPATH SCRIPT : $realpath_script\n";
my $realpath_file = realpath( 'C:\TEMP\file.txt' );
print ("REALPATH FILE : $realpath_file\n"); |
Voici ma sortie :
FILEPARSE SCRIPT : script.pl
FILEPARSE PATH : C:\TEMP\
REALPATH SCRIPT : C:\TEMP\script.pl
REALPATH FILE : C:/TEMP/file.txt
Le realpath sur une chaine de caractère semble transformer les anti-slashs en slashs (ligne REALPATH FILE).
Le realpath sur une variable semble sortir des anti-slashs, sans les transformer (ligne REALPATH SCRIPT).
D'où vient la différence ?
Merci
Bulldog