Mail Archives: cygwin/2007/12/07/17:41:45
On Dec 7, 2007 4:53 PM, Michael Kairys <kairys AT comcast DOT net> wrote:
> Well, I gave it a try, and I can see that ain't gonna happen :)
>
> I reran setup and let it install perl and whatever else it wanted to (so I now
> have ruby and phython as well); then I began running scripts under both perls.
> I quickly realized AS perl exec's cmd.exe whilst Cygwin perl exec's sh, so
> much of my system and backquote constructs broke. I also noticed that ENV
> {PATH} and ENV{HOME} return Windows or Unix syntax paths, depending. The
> Cygwin perl builtins like chdir and chmod were quite happy with Windows paths,
> as I would expect.
>
> As an aside, there seems to be something broken in my installation re. Tk (or
> perhaps I'm missing something). If I run a script containing (only) "use Tk" I
> get: Can't load '/usr/lib/perl5/vendor_perl/5.8/cygwin/auto/Tk/Tk.dll' for
> module Tk: No such file or directory
> at /usr/lib/perl5/5.8/cygwin/DynaLoader.pm line 230.
>
> ... however /usr/lib/perl5/vendor_perl/5.8/cygwin/auto/Tk/Tk.dll is in fact
> there.
>
> So given that I "should" keep Cygwin perl around (meaning that someday I'm
> likely to regret it if I don't :) and that I'm going to keep AS perl as well,
> I need to find the best way for them to coexist. I think the suggestion made
> elsewhere in this thread (sorry, I forget who made it) that I forego "perl -S"
> in favor of shebang is good; I find that #!/local/perl/bin/perl finds my AS
> perl (which is in D:\Local\Perl, and D:\Local is mounted on /local). ASsuming
> Cygwin correctly shebangs any scripts it needs to use, I can remove AS perl
> from my Cygwin path (as set in .bashrc) but leave it in my Windows path (as
> set via the Control Panel) and as I understand it to date, everything should
> work. If I don't in fact understand it (not unlikely :) please advise.
>
> But given my "programmer's OCD" I will probably keep poking at why my AS
> scripts don't run on Cygwin perl, so any advice about setting it up, why Tk
> doesn't work, etc. would be appreciated (as are all your comments).
Using the shebang (#!) line will only be useful for scripts run in
cygwin. Windows will need an association of the .pl extension to the
AS Perl binary in order to run. The shebang line will do nothing for
scripts run by double-clicking on them or those run from the DOS
command line.
I think the biggest problem you're having is conceptual. It's easy to
view a bash prompt as just a better DOS prompt that gives you unix
commands in addition to windows command line commands. THAT is what
is creating the problem here, because cygwin is NOT just a cooler DOS
prompt. It presents the environment to a running program very
differently. It just so happens that most Windows/DOS commands are
too stupid to notice the difference.
Operating under that thought process, it's very easy to create a
mishmash of commands that rely on each other, crossing the boundaries
back and forth between cygwin and windows. Since perl exists in
both... well, you already can see the problems that can cause.
The solution is to start breaking the habit of using a bash prompt for
windows commands. Open a DOS command window and use that (as much as
it hurts). Any perl run from that command window will use AS perl.
Even "better", don't run AS perl scripts from a prompt at all,
double-click on them and start them like any other windows app. Do
not try to use AS perl from a bash prompt. Anything run from a bash
prompt should use cygwin perl.
You should not have AS perl in your cygwin path -- cygwin should not
know about it at all. I also think this is a bad idea:
"#!/local/perl/bin/perl finds my AS perl (which is in D:\Local\Perl,
and D:\Local is mounted on /local)"
As a Programmer, listen to this System Administrator (this one time, I
know it's hard ;-)), this isn't a software issue, it's a management /
usage pattern problem.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -