In a Perl program running under Windows, I had this instruction which should launch a browser with a Help document:
system(1,"start tkquiz.html");
For the uninitiated, "start" will use Windows extension-to-program mapping to find the appropriate program to execute in order to read that file. Think of it as a way to double-click on a file programmatically.
Anyway, the above instruction yielded this less-than-helpful error message:
Access is denied.
I experimented a bit. I copied
tkquiz.pl
to
tkquiz.txt
and tried this:
system(1,"start tkquiz.txt");
It worked.
Running
ls -l
on the directory using
Cygwin, those two files look like this:
-rw-r--r-- 1 David None 6108 Jun 5 22:12 tkquiz.html
-rwxr-xr-x 1 David None 18402 Jun 11 20:52 tkquiz.txt
So Windows wants me to have execute privilege on a file to "start" it. That is a bit of a surprise, since I think of the document being launched as just data. On the other hand, the launching program could be using the data file as code (as in the case of
tkquiz.pl
which would be launched using Perl).
Still under Cygwin,
chmod u+x tkquiz.html
fixes my problem. But, I was driving myself a bit batty trying to figure out the Windows way of doing it. I right-click on the file in Explorer and click Properties, but I don't see the Security tab I am used to seeing. Turns out that
it isn't there by default.
I do wish Windows would stop saving me from myself. I understand that they have a wide variety of users, but there has to be a better way.
No comments:
Post a Comment