perlmon has asked for the wisdom of the Perl Monks concerning the following question:

I am familiar with unix based environment, but have been thrust into a Windows based environment. I have obtained a windows based perl 5.8. How do you run a program in a windows base.

Replies are listed 'Best First'.
Re: Perl for Windows
by Limbic~Region (Chancellor) on May 12, 2003 at 19:31 UTC
    perlmon,
    I gave you the following two answers in the Chatterbox:
  • Associate files with a .pl extension to the perl binary
  • Open up a command window and type perl filename

    Is this not what you mean?

    Cheers and good luck - L~R

Re: Perl for Windows
by crenz (Priest) on May 12, 2003 at 19:37 UTC

    If you use Activestate's Perl distribution, Windows should recognize the file if you add an ".pl" extension. That way, you can just double-click it in e.g. the explorer. Some more hints:

    • If you need to run programs on a regular basis, take a look at the Windows Scheduler (included from Win98 onwards).
    • Open Perl IDE is a nice IDE for Perl on Windows.
    • Take a look at the PPM utility to install precompiled modules
    • You will need MS Visual C++ if you want to compile your own modules for Activestate Perl

    Hope that helps!

Re: Perl for Windows
by LameNerd (Hermit) on May 12, 2003 at 19:57 UTC
    I too was trust into a windows world after working on Unix
    systems most of my career. To keep yourself from going utterly
    mad install cygwin
Re: Perl for Windows
by The Mad Hatter (Priest) on May 12, 2003 at 19:37 UTC
    You need to use the "command line" in Windows. Use the "Run" dialog to start command (for Windows 9x) or cmd (for all other versions, I think). Then, you should be able to type c:/path/to/perl.exe myscript.pl or something similar. I haven't used Windows in a while, but I think that is correct...

    This tutorial (and some of the pages it links to) might also help.

Re: Perl for Windows
by fuzzyping (Chaplain) on May 12, 2003 at 19:39 UTC
    Pretty much the same way you would on Windows. I just learned this myself over the weekend. Install ActiveState's Perl distribution, learn PPM/ASPN, enjoy! Well, as much as one might enjoy working on Windows. ;-)

    Seriously, it's pretty simple. Once you have it installed, just write a test script using the new path for perl. Mine was C:\Perl\bin\perl. Yours might be different.

    When you want to run a script, just make sure it's executable, or simply call the perl binary as the interpreter. Example:

    C:> Perl\bin\perl path\to\script\hello world.pl Hello World!

    Pretty simple. In fact, installing Perl modules is even easier (IMHO) under Windows. Fire up the PPM program:

    C:> Perl\bin\ppm > install CGI::Application .... yadda yadda ....

    Works great for me. I've managed to "port" a number of my web applications written in CGI::Application and HTML::Template with minimal edits. Usually, it's just a matter of changing the shebang line, as mentioned above. Of course, these are primarily webserver-level scripts I speak of. System-level stuff will definitely require much more work.

    HTH!

    -fp
Re: Perl for Windows
by tinypig (Beadle) on May 12, 2003 at 19:37 UTC
    At the command prompt, type: perl <scriptname>

    this is assuming the path to perl is in your path. Otherwise, you might also try: C:\Perl\bin\perl <scriptname> (That works for ActiveState Perl anyway)

    If the .pl extension is associated with the Perl binary, you can also double-click on the script in Explorer.
Re: Perl for Windows
by nite_man (Deacon) on May 13, 2003 at 07:37 UTC
       In addition to the above answers, I would like to say about using Perl in web applications. I've installed and configured Apache 2 with mod_perl 2 (I have got Perl 5.8 on my computer) and Mason but I cannot install Embperl 2 because module for ActivePerl is not exist and doesn't compile under win32, Apache 2 and mod_perl 2. Also, I've had problem with Net::Pcap, but I've found Net::Pcap and Net::PcapUtils in the repository one guy (see here, if you are interested).
    But, in general, Perl works under win32 without big problems.
    I would like to suggest you IDE for Perl:
    • HTMLKIT - very usefull IDE (supports Perl, Java, PHP, HTML etc.). You can configure it easy for run Perl script.
    • AbsolutePerl - very power Perl IDE, but it has Russian interface (unfortunately :-((( )
          
    --------------------------------
    SV* sv_bless(SV* sv, HV* stash);