Randy Kobes wrote:
Thanks, Stas - the diff below implements a t_filepath_cmp to do this, and with it, all tests pass on Win32.
I found one scenario explaining why sometimes this patch is needed, and sometimes not. If I open up a new DOS window, and change into the modperl-2.0 directory (which has both a short and long pathname representation), the long pathname is used, and the patch isn't needed. However, if I then edit a file with the "edit" command within the window (which invokes a terminal-based text editor), afterwards the short pathname of the directory is used. This represents a new level of convenience in working with Win32 ;)
MicroSoft needs to send windows developers extra milk, as if they have been working in the radioactive zone :)
Anyway, this diff should work whether the long or the short pathname is being used.
Great!
========================================================= Index: Apache-Test/lib/Apache/TestUtil.pm
[...]
+# Essentially t_cmp, but on Win32, first converts pathnames +# to their DOS long name. +sub t_filepath_cmp ($$;$) { + my @args = Apache::TestConfig::WIN32 ? + (Win32::GetLongPathName($_[0]), Win32::GetLongPathName($_[1])) : + ($_[0], $_[1]); + return @_ == 3 ? + t_cmp($args[0], $args[1], $_[2]) : + t_cmp($args[0], $args[1]); +}
+1 with the following style fix:
sub t_filepath_cmp ($$;$) { + my @args = Apache::TestConfig::WIN32 + ? (Win32::GetLongPathName($_[0]), Win32::GetLongPathName($_[1])) + : ($_[0], $_[1]); + return @_ == 3 + ? t_cmp($args[0], $args[1], $_[2]) + : t_cmp($args[0], $args[1]); +}
But don't you have a problem with potential undefs?
Please scratch all my previous rewrites, since they will all fail if the passed arguments are readonly. May be this will work:
sub t_filepath_cmp ($$;$) {
if (Apache::TestConfig::WIN32) {
my @a = (shift, shift);
t_cmp((defined $a[0] ? Win32::GetLongPathName($a[0]) : $a[0]),
(defined $a[1] ? Win32::GetLongPathName($a[1]) : $a[1]),
@_);
}
else {
&t_cmp;
}
}or:
sub t_filepath_cmp ($$;$) {
my @a = (shift, shift);
if (Apache::TestConfig::WIN32) {
$a[0] = Win32::GetLongPathName($a[0]) if defined $a[0];
$a[1] = Win32::GetLongPathName($a[1]) if defined $a[1];
}
t_cmp(@a, @_);
}probably the latter reads better.
again untested.
-- __________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
