Brian Ingerson [08/11/01 19:21 -0800]:
> On 08/11/01 20:50 -0500, [EMAIL PROTECTED] wrote:
> > I've tried using Inline::C with win32 apache cgi.
> > It works fine if Apache is in C:\apache.
> >
> > But with C:\Program Files\Apache Group\apache.
> > (the default install), you get
> >
> > Can't open c:/program/config for output.
>
> I think we've seen this one before. I forget what the resolution was. "Don't
> use whitespace in paths", perhaps?
Sarathy just fixed an age-old bug in system() that fixes most problems like
these. Download ActivePerl 630 to see the difference.
For example:
system('dir /w', 'foo', 'bar');
Before AP630, the result was the same as system(qw(dir /w foo bar)) -- which is
a mistake! It just did a split on whitespace and took the first element to be
the name of executable (and tried various extensions). But what if we now
have an initial argument with spaces?
system('C:\Program Files\bar', 'foo', 'bar');
Then we actually run this: system(qw(C:\Program Files\bar foo bar)).
Obviously incorrect. ActivePerl 630 now handles this correctly, as should
bleadperl and whatever the next 5.6.* release will be.
The short answer is this: if you don't feel like upgrading, don't use spaces
in paths. Here's a solution for you if you insist on not upgrading:
use Win32;
my $apache_dir = Win32::GetShortPathName('C:\Program Files\Apache');
system("$apache_dir\\bin\\something.exe");
As a comforting note, Perl doesn't just have this problem on Windows. If you
were to use spaces in Unix, you'd have just the same problems. Of course,
it's a cardinal sin to use spaces in filenames in Unix. But in theory...
Later,
Neil