delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/04/23/06:54:44

X-Spam-Check-By: sourceware.org
From: "Dave Korn" <dave DOT korn AT artimi DOT com>
To: <cygwin AT cygwin DOT com>
Subject: RE: serial ports
Date: Sun, 23 Apr 2006 11:54:23 +0100
Message-ID: <036501c666c4$4a397320$a501a8c0@CAM.ARTIMI.COM>
MIME-Version: 1.0
X-Mailer: Microsoft Office Outlook 11
In-Reply-To: <007901c66690$98f11ce0$0a01a8c0@p42800e>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On 23 April 2006 05:44, David Christensen wrote:

> Dave Korn wrote:
>> Well then, that's a really good argument for just using the builtin
>> access that cygwin provides through /dev/ttySx instead, isn't it?
>> The way Oliver's original post reads suggests that he was just thrown
>> off by not seeing any devices under the virtual /dev dir, but that
>> doesn't mean it won't work for him if he tries it.
> 
> As they say in Perl parlance, TIMTOWDI ("there's more than one way to do
> it").

  I thought perl dudes tend to say things like TIMTOTNHAFTWTDAGT ("there is
more than one thousand nine hundread and forty-three ways to do any given
thing")....

> If Oliver is a C, etc., programmer fluent in the /dev/ttySx API, then
> it could work.  

  But you have a level confusion here.  What you refer to as "the /dev/ttySx
API" is not a feature of C, any more than it's a feature of Perl.  It's a
feature of POSIX programming environments.  If you're on a POSIX system, you
get /dev/ttySx in *every* programming language - Perl, C, the whole lot.

  Also, the very fact that Oliver was asking after where the /dev/ttySx
devices had gone to is kind of a giveaway that he feels happy using it, isn't
it?  You need to actually /read/ people's questions and tailor your answers to
what they've asked, not what you feel would be good for them.

> But if Oliver wants to write idiomatic Perl and get his
> application going faster and easier,

  You should perhaps have stated these conditions in your first post, it's a
bit less-informative to leave out the conditions which make a piece of advice
valid when you offer it.

> then he wants to use standard and accepted CPAN libraries 

  Perl needs a library just to open and read and write a file and perhaps send
a few ioctls ????

  BTW, to me, "print >>$FILE" *is* fairly "idiomatic perl", but I'm just not a
Perl expert I guess.  Is this a case of "Real perl programmers don't output to
files!" ?

> rather than roll his own (especially non-portable ones).  

  And you happen to know what Oliver wants to do?  I didn't see him make any
suggestion he was going to roll hiw own libraries and use non-portable ones.
You're starting to make an /awful/ lot of assumptions here without having any
explicit knowledge of what Oliver actually wants.

> Win32::SerialPort (Windows) and Device::SerialPort (Unix/Linux) are
> the best approach under Perl. One or both may work under Cygwin; I haven't
> done serial port programming in a number of years, and needed ActiveState
> Perl the last time I did.

  Trying to mix win32 perl and cygwin is a recipe for tears.  Sure, use CPAN
modules, that is of course a good idea; but if the *nix one doesn't work under
cygwin, fixing it or rolling your own or even just using the bog-standard file
i/o features in perl is definitely far safer.

>  YMMV. 

  Well, that's the point isn't it?  The OP just asked for help because he
wasn't sure of the mapping of com ports to /dev/ttySx numbers.  Your advice to
install active state perl and some win32 module seems a bit more superfluous
effort than merely subtracting one from the com port number and using
/dev/ttySx.

  Do perl people also say WDITEWWYCDITHWATTTALITB?  "Why do it the easy way
when you can do it the hard way and take ten times as long into the bargain"?
;)


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


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


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019