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?
Also I believe this can be made shorter, using &foo syntax which propogates @_, ala AUTOLOAD.
sub t_filepath_cmp ($$;$) {
if (Apache::TestConfig::WIN32) {
for my $arg (@_[0..1])
$arg = Win32::GetLongPathName($arg) if defined $arg;
}
}
&t_cmp; # propogates @_
}or may be the following more explicit version reads better:
sub t_filepath_cmp ($$;$) {
if (Apache::TestConfig::WIN32) {
$_[0] = Win32::GetLongPathName($_[0]) if defined $_[0];
$_[1] = Win32::GetLongPathName($_[1]) if defined $_[1];
}
&t_cmp; # propogates @_
}none of these was tested, but now there is no style to fix :)
And your patch lacks the pod section explaining this function ;)
Please remind us if we forget to use that new function when comparing paths :)
-- __________________________________________________________________ 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]
