Randy Kobes wrote: [...]
I couldn't see within Apache a function that would return a Win32 path in this context, and from some of the places that use r->filename and the like, it appears that a Unix-like path is assumed. Might this be for convenience, in that a filename can be used to construct a URL, and they didn't want to get into a lot of conversions when doing so?
I suppose so. [...]
Yes, it's ugly and those of us coding on unix will never remember to do that, leaving you with the boring cleanup job. Therefore please think of extending Apache::TestXXX API to have this Win32::GetLongPathName part hidden within. Both join "/", .. and Win32::GetLongPathName can go inside. e.g. catfile_normalized() and caturl_normalized()? where any post-processings like Win32::GetLongPathName will come from the _normalized part? I'm not sure if the name selection is good. Does it sound good?
Yes, that sounds much better - I just included the diff as an indication of what needed to be done. How about the following:
========================================================= Index: Apache-Test/lib/Apache/TestUtil.pm =================================================================== RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestUtil.pm,v retrieving revision 1.31 diff -u -r1.31 TestUtil.pm --- Apache-Test/lib/Apache/TestUtil.pm 29 Apr 2003 08:04:04 -0000 1.31 +++ Apache-Test/lib/Apache/TestUtil.pm 1 Dec 2003 07:03:50 -0000 @@ -26,7 +26,8 @@ t_client_log_error_is_expected t_client_log_warn_is_expected );
[EMAIL PROTECTED] = qw(t_write_perl_script t_write_shell_script t_chown); [EMAIL PROTECTED] = qw(t_write_perl_script t_write_shell_script t_chown + catfile_normalized caturl_normalized);
Right, but I don't quite like the names I've suggested, they are too long and if they go to Util, they probably need to follow the convention and be /^t_/. Do you have any suggestions? I'd prefer a short name
t_makeurl, t_makepath
BTW, regarding Win32::GetLongPathName($f), shouldn't File::Spec be fixed to do the right thing regarding the short path? what about canonpath()?
+sub catfile_normalized {
+ my $f = catfile(@_);
may be run through canonpath as well?
+ return Apache::TestConfig::WIN32 ?
+ Win32::GetLongPathName($f) : $f;
+}
+
+sub caturl_normalized {
+ my $f = File::Spec::Unix->catfile(@_);
+ return Apache::TestConfig::WIN32 ?
+ Win32::GetLongPathName($f) : $f;
}
I'd use an explicit: join '/', @_ here. It doesn't sound right to use File::Spec::Unix->catfile for constructing urls, even if it happens to do that,
If OK, I'll add some comments, and a short pod description in Apache::TestUtil, of what caturl_normalized and catfile_normalized are doing.
sure, but let's polish the names first. There is no rush to patch things before we are happy with the API.
__________________________________________________________________ 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]
