Cygwin and path question

G

G. Randall

I installed Cygwin after I installed an ActiveState Perl distribution.
I'm perfectly content with the ActiveState setup, and while I could
simply re-run the Cygwin setup and exclude perl, I'd like to better
understand what the interaction is. If someone could answer the
following, I'd be grateful.

1. Are there any advantages (from an administrative point of view) to
using Cygwin's perl vs. ActiveState's? My gut feeling is that Cygwin
would require more work to maintain.

2. If I were to use ActiveState's perl, will renaming Cygwin's perl.exe
suffice for the moment? It seems to do the trick, but I'm wondering
whether there's something else related I'm not aware of.

3. If I place a script foo.pl somewhere in my path, I can execute it
elsewhere using the Windows 2000 cmd interpreter by typing "foo.pl". In
Bash, I can type "cmd /C foo.pl". What I don't understand is why under
Bash "perl foo.pl" doesn't work unless I run it from where foo.pl is
actually located.

Thanks!
 
J

John Bokma

G. Randall said:
3. If I place a script foo.pl somewhere in my path, I can execute it
elsewhere using the Windows 2000 cmd interpreter by typing "foo.pl". In
Bash, I can type "cmd /C foo.pl". What I don't understand is why under
Bash "perl foo.pl" doesn't work unless I run it from where foo.pl is
actually located.

That's normal behaviour, the argument to perl is a file, and perl must
see the file in the current dir. Or you must specify the full path to
the file.

If foo.pl is in your path, foo.pl should work. If your current dir (.)
is not in your path, use ./foo.pl. In a *nix environment you can drop
the .pl extension, and hence create a foo command :-D.
 
K

Ken MacFarlane

G. Randall said:
1. Are there any advantages (from an administrative point of view) to
using Cygwin's perl vs. ActiveState's? My gut feeling is that Cygwin
would require more work to maintain.

If by "maintenance" you mean CPAN modules, ActiveState's ppm is a bit
easier. If you're used to the command line module installs (perl
-MCPAN, etc. or building "by hand"), there's little-to-no difference
between Cygwin Perl and any other (espcially on Linux/Unix).

-Ken
 
W

Warren Young

G. Randall said:
1. Are there any advantages (from an administrative point of view) to
using Cygwin's perl vs. ActiveState's? My gut feeling is that Cygwin
would require more work to maintain.

Cygwin perl is updated automatically when you re-run Cygwin's setup.exe.
Once it's installed, you don't have to do anything special to keep it
updated. ActiveState perl you have to go and download from their web
site periodically.

As for CPAN vs. ppm, I prefer CPAN simply because I'm used to it. It
works just like on *ix.

Also, if you need Perl to interact with the Cygwin mount scheme and
other filesystem magic Cygwin provides (e.g. /proc), you'll need to use
Cygwin Perl.
2. If I were to use ActiveState's perl, will renaming Cygwin's perl.exe
suffice for the moment?

Re-run Cygwin's setup.exe and tell it to uninstall Perl. That will get
rid of everything.
It seems to do the trick, but I'm wondering
whether there's something else related I'm not aware of.

Perl is set up to allow multiple installations of Perl on a single
machine. Each Perl binary knows where to find its related files. As
long as each is set to use a different directory for modules and such,
they can work side by side.
3. If I place a script foo.pl somewhere in my path, I can execute it
elsewhere using the Windows 2000 cmd interpreter by typing "foo.pl". In
Bash, I can type "cmd /C foo.pl". What I don't understand is why under
Bash "perl foo.pl" doesn't work unless I run it from where foo.pl is
actually located.

$ chmod +x /path/to/foo.pl
$ foo.pl
 
J

Joe Smith

G. Randall said:
2. If I were to use ActiveState's perl, will renaming Cygwin's perl.exe
suffice for the moment? It seems to do the trick, but I'm wondering
whether there's something else related I'm not aware of.

No need to rename or anything. The two versions of perl can co-exist.
They operate differently. For example:

open IN, '/etc/shells' or die;

With cygwin, that looks for /etc/shells starting at cygwin's logical root.
With ActivePerl, that looks for D:\etc\shells if your default disk is D,
which may make the outcome nondeterministic.

Programs like perl using cygwin libraries handle a lot more Unix/Linx/POSIX
features, like symlinks.

I often have two DOS windows open: one Command Prompt using cmd.exe and
the other running bash under cygwin.

-Joe
 
D

Darren Dunham

G. Randall said:
1. Are there any advantages (from an administrative point of view) to
using Cygwin's perl vs. ActiveState's? My gut feeling is that Cygwin
would require more work to maintain.

Cygwin perl can handle all the file pathing and other features of
cygwin. You can pass in files like /usr/local/foo. The AS perl can't
cope with that. You'd probably have to specify something closer to
C:/cywgin/usr/local/foo.

I generally have both installed on windows boxes that I'm using for a
long period of time, but I tend to work more with the AS copy for some
reason.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top