Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Message-ID: <006601bf84bd$49fbfe40$1bed70d8@0015231392> From: "James E Keenan" To: Subject: Can Perl Run from Shebang Line on BASH Shell on Windows 98 Computer? Date: Thu, 2 Mar 2000 22:05:09 -0500 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0063_01BF8493.60429B20" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 ------=_NextPart_000_0063_01BF8493.60429B20 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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.=20 Objectives: I have multiple objectives in studying Perl.=20 (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.=20 (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 = () 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? ------=_NextPart_000_0063_01BF8493.60429B20 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

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

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

           =20            =20 BASH shell downloaded from Cygwin, version B20.=20

Objectives: = I have=20 multiple objectives in studying Perl.

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

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

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

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

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

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

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

Can anybody=20 help?

------=_NextPart_000_0063_01BF8493.60429B20--