This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Can Perl Run from Shebang Line on BASH Shell on Windows 98 Computer?


I am having problems running Perl on my Windows 98 machine using the Cygwin B-32 BASH shell. While I can run Perl from the command line, I cannot yet get "stand-alone" Perl programs to run, i.e., programs where Perl runs not because the command "perl -e" is evoked in the first position on the command line but rather because the ".pl" file itself has information concerning the location of the Perl interpreter on the computer.

Installation:             Perl version 5.005_03 built for MSWin32-x86-objec.  Binary build 522 from ActiveState Tool Corp.

                        BASH shell downloaded from Cygwin, version B20.

Objectives: I have multiple objectives in studying Perl.

(1) Write CGI scripts for Web site am designing. Am working my way thru E. Castro's "Perl and CGI for the World Wide Web" (Peachpit Press). Have directory on a friend's server which I can use for practice purposes; server runs Apache web server with BASH-2.02 shell. Have learned enough Unix to Telnet to that server, get around it, change permissions, etc. So far so good.

(2) On my job (hospital) I face problem of editing text files (client medication histories) so as to make them conform to a certain database format.  Friend with Perl expertise says this would be an ideal job for Perl.  However, job would have to be done on PC rather than over network/Net to a file server.

Question arises:  Should I learn Perl thru an MS-DOS command line for this application, while learning Perl thru BASH command line for regular Web application?  My thinking:  It would probably be simpler to learn one command line (BASH) first.  However, that means that I have to get the BASH shell to work on a Windows 9x machine -- and that I have to get Perl to work properly on that shell.

Hence the Cygwin and ActiveState downloads.  But my Perl practice programs only seem to work when "perl -e" is called on the command line.  I can't get programs which start with the shebang line to run.  In addition, the command "which perl" doesn't work.  It generates the message:  "bash:  which:  command not found".

Research:            My research into this problem has generated contradictory information.  The ActivePerl FAQ (<http://www.activestate.com/ActivePerl/docs/perl-win32/perlwin32faq4.html>) states:  "...Win32 platforms don't provide the shebang syntax, or anything like it.  The FAQ suggests (a) calling the perl interpreter directly (as in "perl myscript.pl"), (b) installing an Apache webserver on a Win32 system (which does accept the shebang syntax) or (c) converting Perl script into a batch file using the "pl2bat" utility distributed with Perl for Win32.  (b) and (c) seem overly complex, especially to a beginner like me.

The O'Reilly book Learning Perl on Win32 Systems, however, says (p.9 fn.), "...there are Win32 ports of UNIX shells (e.g., tcsh, ksh, and bash) that do understand shebang lines.  If you're using one of these shells, you can use shebang lines by specifying the path to your Perl interpreter."

Vincent Lowe’s Perl Programmer’s Interactive Workbook (Prentice Hall PTR) states that “For MS-DOS operation, you’ll need to make the program look like a batch file and have it start Perl for you.” (p.23)  However, it’s not clear whether this applies to any DOS-based system (including my Windows 98 system) or just to the MS-DOS shell and command line.  If the former, then on a Windows computer I’ll have to learn Perl via the DOS command line; BASH would be useless.  If the latter, I should be able to learn Perl via the BASH command line, whether the installation is a Windows computer or Unix.

Can anybody help?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]