Cygwin and path question

Discussion in 'Perl Misc' started by G. Randall, Apr 8, 2004.

  1. G. Randall

    G. Randall Guest

    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!
     
    G. Randall, Apr 8, 2004
    #1
    1. Advertising

  2. G. Randall

    John Bokma Guest

    G. Randall wrote:

    > 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.

    --
    John personal page: http://johnbokma.com/

    Experienced Perl / Java developer available - http://castleamber.com/
     
    John Bokma, Apr 8, 2004
    #2
    1. Advertising

  3. G. Randall wrote:
    > 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
     
    Ken MacFarlane, Apr 8, 2004
    #3
  4. G. Randall

    Warren Young Guest

    G. Randall wrote:

    > 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
     
    Warren Young, Apr 8, 2004
    #4
  5. G. Randall

    Joe Smith Guest

    G. Randall wrote:

    > 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
     
    Joe Smith, Apr 8, 2004
    #5
  6. G. Randall <> wrote:
    > 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.

    --
    Darren Dunham
    Senior Technical Consultant TAOS http://www.taos.com/
    Got some Dr Pepper? San Francisco, CA bay area
    < This line left intentionally blank to confuse you. >
     
    Darren Dunham, Apr 9, 2004
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    520
  2. Replies:
    0
    Views:
    461
  3. WELCOME to

    , Sep 3, 2003, in forum: Python
    Replies:
    1
    Views:
    538
    Robin Becker
    Sep 5, 2003
  4. Replies:
    0
    Views:
    424
  5. Berlin Brown

    Cygwin and path issues

    Berlin Brown, May 6, 2008, in forum: Python
    Replies:
    0
    Views:
    348
    Berlin Brown
    May 6, 2008
Loading...

Share This Page