Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi, I connect to a unix system via putty (ssh) and execute my perl scripts from there. I'd know like to execute Perl from my own PC. My PC runs Windows NT 4. The types of libaries I use include CGI, DBI, GD, LWP::Simple, HTML::TokeParser. I've no idea what I need to get started, any suggestions, thanks.
Re: A Perl Environment
by davorg (Chancellor) on Mar 04, 2003 at 15:21 UTC
|
To develop Perl programs under Windows, download ActivePerl from ActiveState. You can install any extra modules using ppm. If you want to test CGI programs on the same system, then I recommend you get Apache.
--
<http://www.dave.org.uk>
"The first rule of Perl club is you do not talk about
Perl club." -- Chip Salzenberg
| [reply] [Watch: Dir/Any] |
|
thanks dave, I actually want to run a *.pl from my own PC - one of my scripts is using to much of the unix systems isdn bandwidth. So, I have the script writen already, I just want to run it from my own machine which has its own isdn connection. Thanks.
| [reply] [Watch: Dir/Any] |
|
| [reply] [Watch: Dir/Any] |
Re: A Perl Environment
by Molt (Chaplain) on Mar 04, 2003 at 15:24 UTC
|
Two options really, go for ActiveState's version of Perl, or install CygWin to have a UNIX-like compatibility layer, and use the normal Perl for UNIX on it.
Personally I tend to go for the Cygwin solution since it means my scripts are more likely to work on the UNIX servers we use without needing modification, and also because I generally find Cygwin in and of itself to be a very useful thing to have installed on a Windows machine as it provides the UNIX command line tools I tend to use a lot.
| [reply] [Watch: Dir/Any] |
|
Lies, all lies , all lies ...
All you need is a compiler, and the perl source.
Get source at cpan.org.
Get free compiler. There are two that are supposed to work, Borland
(i can verify it works, look for freecommandlinetools.exe) and MinGW (i tried, didn't work for me)
| [reply] [Watch: Dir/Any] |
|
activestate - love it. Reference material, tuts, snippets, oh and uh, the app. How do I teach my browser to use it when I try to run things from the address line? Its on my 98 box.
cygwin - Wouldn't go in. Any other unix shell emulator reccomendations?
| [reply] [Watch: Dir/Any] |
Re: A Perl Environment
by meetraz (Hermit) on Mar 04, 2003 at 23:05 UTC
|
Once you have perl set up on Windows, there are a few tricks you can use to make it easier to execute them. Normally, on unix & windows, you can execute a perl script like this:
perl myscript.pl
On Unix, if you don't want to type the "perl" part anymore, you just add a "shebang" line like "#!/usr/bin/perl" to the top of your file, mark the file as executable (chmod u+x myscript.pl) and then you can execute it like this:
myscript.pl
But this won't work on NT. Here's how to accomplish something similar:
ASSOC .pl=PerlScript
FTYPE PerlScript=perl.exe %1 %*
Now you can execute your scripts without first typing "perl" just like on unix.
You can also one step further. There is a system environment variable called "PATHEXT". Go get to it, right-click on "My Computer", select "properties", then click "Advanced", then "Environment Variables" (Might be different for NT). Find the "PATHEXT" variable under the system section, and add ".PL" to it. Now, no matter where you are on your system, if your script is in the path, you can call it like this:
myscript
So now even though its called "myscript.pl" it works just like a ".exe" or ".com" file - you don't need to specify the extension, and you can call any perl script in your path from anywhere on the system.
| [reply] [Watch: Dir/Any] |
|
If I recall correctly the ActiveState installer does a lot of this for you. I think I had to add the .pl to the PATHEXT, but the rest was done automagically. Just a FYI. And, um, a not-100%-sure FYI at that...
| [reply] [Watch: Dir/Any] |
Re: A Perl Environment
by t'mo (Pilgrim) on Mar 04, 2003 at 16:29 UTC
|
Hey guys, don't forget about IndigoPerl, which is distributed with Apache.
Update: That should read, "...IndigoPerl, which includes an Apache executable".
| [reply] [Watch: Dir/Any] |
Re: A Perl Environment
by jonadab (Parson) on Mar 05, 2003 at 12:41 UTC
|
Others have pointed out the various options. As someone
else said, the two main options are ActiveState and
cygwin. What I'd like to point out are the reasons
you might choose one over the other.
The ActiveState Perl has all sorts of convenient
stuff that makes using Perl on _Windows_ easier or
better or whatever. Someone pointed out the
association stuff (so you can double-click a Perl
script and run it), but there's also some other
stuff, not least of all a bunch of Win32:: modules.
Oh, and it's got the documentation as HTML, in case
you don't like fiddling with the commandline doc
utilities. (A lot of Windows people don't. Since
you've been using Perl on Unix, you probably don't
mind that.) For installing modules, it comes with
something called PPM (Perl Package Manager), which
retrieves precompiled modules from ActiveState's
repository and installs them. A lot of CPAN modules
are not available, but installing modules is fast
(because you don't need to compile them) and you
don't have to worry that one might not be compatible
and will break on Windows.
The reasons to choose the Cygwin offering are different,
and have more to do with creating an environment that
is similar to a Unix box. (It's especially similar to
Linux.) Cygwin comes with a gcc and make and whatnot
and a POSIX emulation layer, so it is possible to get
CPAN.pm working and install modules from CPAN. You
get the usual Unix commandline tools, so if your scripts
are fond of using backticks, they're less likely to
break than on ActiveState. You get vim and Emacs, so
if you're used to editing the scripts on the Unix box,
you've got a familiar editor. (vim and Emacs are of
course also available separately for Windows.) The
POSIX emulation layer means you can use the same
shebang line (#!/usr/bin/perl or whatever) as on the
Unix system, so you can transfer scripts back and
forth and run them unchanged. (Then again, with
the ActiveState association mechanism the shebang
line doesn't actually matter (unless you're doing
CGI; Apache seems to require it), so you can still
run them unchanged anyway.)
I started using Perl with ActiveState Perl. Later
I got cygwin because I wanted bash and stuff, and
these days I'm using Linux. I'd say, if all you
want is to run Perl on Windows, go with the ActiveState
distribution, but if what you want is a Unix-like
environment, that's what Cygwin is for. Both are
good at what they do, and if you write reasonably
portable Perl it'll run pretty much unchanged in
either environment.
If you use lots of system-specific
stuff, like launching external processes and so on,
then of course there are differences. ActiveState
Perl is better for using OLE to talk to MS Word, but
the cygwin distribution is better if you want to
open PING, "ping $addy | grep $re |";
and read from it, or something like that. If you
don't do either of those things, you might be in
the "I write portable Perl so it doesn't matter"
category, in which case either distribution will
do just fine.
for(unpack("C*",'GGGG?GGGG?O__\?WccW?{GCw?Wcc{?Wcc~?Wcc{?~cc'
.'W?')){$j=$_-63;++$a;for$p(0..7){$h[$p][$a]=$j%2;$j/=2}}for$
p(0..7){for$a(1..45){$_=($h[$p-1][$a])?'#':' ';print}print$/}
| [reply] [Watch: Dir/Any] [d/l] [select] |
|
Thanks all, I managed to get cygwin to work, and I have all the .pm's installed now also. The only problem I'm having is in relation to getting perl to accessing mysql -
http://www.perlmonks.org/index.pl?node_id=240434
| [reply] [Watch: Dir/Any] |
Re: A Perl Environment
by OM_Zen (Scribe) on Mar 04, 2003 at 20:49 UTC
|
Hi ,
The perl along with apache as a bundle is itself available in sites to download ActiveState or you can go to
Perl Downloads Site to get to sites to dowload perl apache for any operating system . The installation in Windows is pretty nice and easy to do
| [reply] [Watch: Dir/Any] |
Re: A Perl Environment
by andyram27 (Initiate) on Mar 05, 2003 at 07:39 UTC
|
I would definately agree with Activestate's perl binary. I would also recommend trying out Textpad, a free graphical editor. You can configure buttons to run perl or virtually any other executable, and has document tabs; very useful when you have scripts and errorlogs open. | [reply] [Watch: Dir/Any] |
|
| [reply] [Watch: Dir/Any] |
|
|