New from a newbie!
This code is really Java Script, but it has saved me a few keystrokes. On my desktop I run Apache Webserver as bundled with Indigo Perl 5.6. Apache has a start page that begs you to do something a little more intersting with it. The cgi-bin directory isn't browsable, so I added this small bit to the welcome screen to jump straight to a script in the cgi-bin directory:
<script language=JavaScript1.2> function openScript () { var targetURL=document.form1.file1.value; targetURL=targetURL.substring(targetURL.lastIndexOf('\\')+1, targetURL.length); alert (targetURL); document.location.href='http://localhost:4444/cgi-bin/'+targetURL; } </script>
There are a few things you could do to make this not necessary at all. You could enable directory browsing with a .htaccess file, but on a Window$ machine you aren't allowed to have files without a name (e.i., files with only an extension, like .htaccess, are not allowed on a Window$ machine). You could configure Apache to look for directory level commands somewhere other than a .htaccess file, but that's just too deep for a newbie like me ;)

And this could be tweaked with more inputs incase you wanted to actually pass something to a script. But for now I'm not advanced enough to write scripts that need anything passed to them. Maybe when I finish Ovid's intro to CGI course.....
Petras
perl=>firmware;
#Then I'd be a Chip Monk.

Replies are listed 'Best First'.
Re: Saving Keystrokes to Preview Scripts Locally with Apache
by blahblahblah (Priest) on Jan 31, 2003 at 12:21 UTC
    I also run apache on windows 98. It's pretty easy to set up per-directory access control, once you know how. You can just run the bin\htpasswd command, like this:
    E:\Program Files\Apache\bin>htpasswd -c ..\conf\test.txt joe Automatically using MD5 format on Windows. New password: *** Re-type new password: *** Adding password for user joe E:\Program Files\Apache\bin>more ..\conf\test.txt joe:$apr1$wv5.....$FOCsTs66yrYW/dOooo2E9. E:\Program Files\Apache\bin>
    (If you run it with no args it will give you a usage message.) After running it, I can add these lines to my httpd.conf to protect my c:\cgi-bin and c:\mp3 dirs:
    # password protect C:\cgi-bin and all subdirectories # <Directory "C:\cgi-bin"> # other restricted directories can share this name AuthName "go away" # either Basic or Digest is supposed to work - only Basic seems to AuthType Basic # User/Password file AuthUserFile "E:\Program Files\Apache\conf\test.txt" # Only users in user file can access this dir Require valid-user </Directory> # same AuthName for C:\mp3 # <Directory "C:\mp3"> AuthName "go away" AuthType Basic AuthUserFile "E:\Program Files\Apache\conf\test.txt" Require valid-user </Directory>
    The only thing I'm not sure of is whether IndigoPerl's bundled apache includes support for this. I'd say if the htpasswd.exe program is there then it does. I know thier apache is pretty minimal: I started out a few years ago using the apache that was bundled with IndigoPerl but ditched it and installed a normal apache when I couldn't get java servlets to work with IndigoPerl's.
Re: Saving Keystrokes to Preview Scripts Locally with Apache
by Aristotle (Chancellor) on Jan 31, 2003 at 13:43 UTC
    What about the AccessFileName configuration directive?

    Makeshifts last the longest.

Re: Saving Keystrokes to Preview Scripts Locally with Apache
by hardburn (Abbot) on Jan 31, 2003 at 16:31 UTC

    . . . but on a Window$ machine you aren't allowed to have files without a name (e.i., files with only an extension, like .htaccess, are not allowed on a Window$ machine).

    Yes, you can. You just can't do it by creating a new file in the GUI. Cygwin will let you create a file that has no "name" (as far as Windows thinks), and you can FTP in such a file, too.

    The problem is that the DOS stores the extention in a seperate part of the filesystem's datastrcture from the name itself. And thus the DOS fs manages to be both simple-stupid and over-engineered at the same time.

      This works without Cygwin:

      ren anyfile.txt .htaccess

      /J

      That's pretty cool. I learned something usefull (to make make .ht* files from a M$ DO$ prompt, and there's something else to add to my list of quippy complaints about Micro$oft. My favorite is Bill Gate$ as seen on the Simpsons: "You don't think I got to be the richest man in the world by writing checks, do you?"

      Thanks for the tip.
      -Petras
        Please get over this M$ DO$ trip that you are on. Its kinda rude, and fairly ignorant. Perl is a cross platform language by intention. It runs on just about everything. Including all the flavours of Win32, and even possibly on DOS. The fact that it does has undoubtadly contributed to its success and popularity. So slanging matches about OS's and machines don't impress people much.

        On a different note, I think i should explain why im even bothering to write this. To me the "M$ DO$" betrays a contempt that is dangerous. Whatever you personally think about Win32, the fact is that it is successful, popular, and generally speaking very good at what it sets out to do. The fact that what it is intended to do, and what you want it to do are different is a completely seperate matter. Win32 should be the subject of study and analysis, its strengths should be emulated and its mistakes avoided. *NIX and open source will never replace Win32 in the business and average home until its supporters start taking it seriously.

        (I should say that many many people in the open source community do take Win32 very seriously. If it was open sourced tomorrow and MS disappeared it would still be ticking years from now. In fact it would probably do very very well.)

        --- demerphq
        my friends call me, usually because I'm late....

      C:\>echo test > .htaccess C:\>type .htaccess test C:\>dir .* Volume in drive C has no label. Directory of C:\ 03/02/02 06:43a 7 .htaccess 1 File(s) 7 bytes 259,147,776 bytes free C:\>

      Guess it depends on which flavour of Win.